/*      */ package com.evitch.csvtrade.cmd;
/*      */ 
/*      */ import com.evitch.csvtrade.StrategyRunner;

/*      */ import java.text.SimpleDateFormat;
/*      */ import java.util.Date;
import java.util.TimeZone;
/*      */ 
/*      */ public class MT4
/*      */ {
/*      */   StrategyRunner strategyRunner;
/*      */   StrategyRunner ordersProcessingChannel;
/*      */   private static final String T1970_01_01 = "1970.01.01 00:00";
/*      */   private static final String YYYY_MM_DD_HH_MM = "yyyy.MM.dd HH:mm";
/*      */ 
/*      */   protected long getTZCorrectionOffset(long time)
/*      */   {
/*   55 */     return -TimeZone.getDefault().getOffset(time);
/*      */   }
/*      */ 
/*      */   public void setStrategyRunner(StrategyRunner strategyRunner)
/*      */   {
/*   62 */     this.strategyRunner = strategyRunner;
/*      */   }
/*      */ 
/*      */   public void setOrdersProcessingChannel(StrategyRunner strategyRunner) {
/*   66 */     this.ordersProcessingChannel = strategyRunner;
/*      */   }
/*      */ 
/*      */   public StrategyRunner getStrategyRunner() {
/*   70 */     return this.strategyRunner;
/*      */   }
/*      */ 
/*      */   public Date marketInfo_MODE_TIME(String symbol)
/*      */     throws ErrUnknownSymbol
/*      */   {
/*   82 */     long time = (long)marketInfo(symbol, MarketInfo.MODE_TIME) * 1000L;
/*   83 */     Date res = new Date(time + getTZCorrectionOffset(time));
/*   84 */     return res;
/*      */   }
/*      */ 
/*      */   public int iBars(String symbol, Timeframe timeframe)
/*      */     throws ErrHistoryWillUpdated, ErrUnknownSymbol
/*      */   {
/*   99 */     StringBuilder command = new StringBuilder("0 iBars");
/*      */ 
/*  103 */     command.append(' ').append('[').append(symbol).append(']');
/*  104 */     command.append(' ').append('[').append(timeframe.val).append(']');
/*      */ 
/*  106 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  107 */     int ix = result.indexOf('@');
/*  108 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  109 */     switch (error) { case 4066:
/*  110 */       throw new ErrHistoryWillUpdated();
/*      */     case 4106:
/*  111 */       throw new ErrUnknownSymbol();
/*      */     }
/*  113 */     if (error != 0) {
/*  114 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  118 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  123 */     int res = Integer.parseInt(result);
/*  124 */     return res;
/*      */   }
/*      */ 
/*      */   public int iBarShift(String symbol, Timeframe timeframe, Date time, boolean exact)
/*      */     throws ErrUnknownSymbol
/*      */   {
/*  143 */     StringBuilder command = new StringBuilder("1 iBarShift");
/*      */ 
/*  147 */     command.append(' ').append('[').append(symbol).append(']');
/*  148 */     command.append(' ').append('[').append(timeframe.val).append(']');
/*  149 */     command.append(' ').append('[').append(time == null ? "1970.01.01 00:00" : new SimpleDateFormat("yyyy.MM.dd HH:mm").format(time)).append(']');
/*  150 */     command.append(' ').append('[').append(exact ? 1 : 0).append(']');
/*      */ 
/*  152 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  153 */     int ix = result.indexOf('@');
/*  154 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  155 */     switch (error) { case 4106:
/*  156 */       throw new ErrUnknownSymbol();
/*      */     }
/*  158 */     if (error != 0) {
/*  159 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  163 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  168 */     int res = Integer.parseInt(result);
/*  169 */     return res;
/*      */   }
/*      */ 
/*      */   public double iClose(String symbol, Timeframe timeframe, int shift)
/*      */     throws ErrHistoryWillUpdated, ErrUnknownSymbol
/*      */   {
/*  186 */     StringBuilder command = new StringBuilder("2 iClose");
/*      */ 
/*  190 */     command.append(' ').append('[').append(symbol).append(']');
/*  191 */     command.append(' ').append('[').append(timeframe.val).append(']');
/*  192 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/*  194 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  195 */     int ix = result.indexOf('@');
/*  196 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  197 */     switch (error) { case 4066:
/*  198 */       throw new ErrHistoryWillUpdated();
/*      */     case 4106:
/*  199 */       throw new ErrUnknownSymbol();
/*      */     }
/*  201 */     if (error != 0) {
/*  202 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  206 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  211 */     double res = Double.parseDouble(result);
/*  212 */     return res;
/*      */   }
/*      */ 
/*      */   public double iHigh(String symbol, Timeframe timeframe, int shift)
/*      */     throws ErrHistoryWillUpdated, ErrUnknownSymbol
/*      */   {
/*  229 */     StringBuilder command = new StringBuilder("3 iHigh");
/*      */ 
/*  233 */     command.append(' ').append('[').append(symbol).append(']');
/*  234 */     command.append(' ').append('[').append(timeframe.val).append(']');
/*  235 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/*  237 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  238 */     int ix = result.indexOf('@');
/*  239 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  240 */     switch (error) { case 4066:
/*  241 */       throw new ErrHistoryWillUpdated();
/*      */     case 4106:
/*  242 */       throw new ErrUnknownSymbol();
/*      */     }
/*  244 */     if (error != 0) {
/*  245 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  249 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  254 */     double res = Double.parseDouble(result);
/*  255 */     return res;
/*      */   }
/*      */ 
/*      */   public double iLow(String symbol, Timeframe timeframe, int shift)
/*      */     throws ErrHistoryWillUpdated, ErrUnknownSymbol
/*      */   {
/*  272 */     StringBuilder command = new StringBuilder("4 iLow");
/*      */ 
/*  276 */     command.append(' ').append('[').append(symbol).append(']');
/*  277 */     command.append(' ').append('[').append(timeframe.val).append(']');
/*  278 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/*  280 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  281 */     int ix = result.indexOf('@');
/*  282 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  283 */     switch (error) { case 4066:
/*  284 */       throw new ErrHistoryWillUpdated();
/*      */     case 4106:
/*  285 */       throw new ErrUnknownSymbol();
/*      */     }
/*  287 */     if (error != 0) {
/*  288 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  292 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  297 */     double res = Double.parseDouble(result);
/*  298 */     return res;
/*      */   }
/*      */ 
/*      */   public double iOpen(String symbol, Timeframe timeframe, int shift)
/*      */     throws ErrHistoryWillUpdated, ErrUnknownSymbol
/*      */   {
/*  315 */     StringBuilder command = new StringBuilder("5 iOpen");
/*      */ 
/*  319 */     command.append(' ').append('[').append(symbol).append(']');
/*  320 */     command.append(' ').append('[').append(timeframe.val).append(']');
/*  321 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/*  323 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  324 */     int ix = result.indexOf('@');
/*  325 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  326 */     switch (error) { case 4066:
/*  327 */       throw new ErrHistoryWillUpdated();
/*      */     case 4106:
/*  328 */       throw new ErrUnknownSymbol();
/*      */     }
/*  330 */     if (error != 0) {
/*  331 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  335 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  340 */     double res = Double.parseDouble(result);
/*  341 */     return res;
/*      */   }
/*      */ 
/*      */   public double iVolume(String symbol, Timeframe timeframe, int shift)
/*      */     throws ErrHistoryWillUpdated, ErrUnknownSymbol
/*      */   {
/*  358 */     StringBuilder command = new StringBuilder("6 iVolume");
/*      */ 
/*  362 */     command.append(' ').append('[').append(symbol).append(']');
/*  363 */     command.append(' ').append('[').append(timeframe.val).append(']');
/*  364 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/*  366 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  367 */     int ix = result.indexOf('@');
/*  368 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  369 */     switch (error) { case 4066:
/*  370 */       throw new ErrHistoryWillUpdated();
/*      */     case 4106:
/*  371 */       throw new ErrUnknownSymbol();
/*      */     }
/*  373 */     if (error != 0) {
/*  374 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  378 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  383 */     double res = Double.parseDouble(result);
/*  384 */     return res;
/*      */   }
/*      */ 
/*      */   public Date iTime(String symbol, Timeframe timeframe, int shift)
/*      */     throws ErrHistoryWillUpdated, ErrUnknownSymbol
/*      */   {
/*  401 */     StringBuilder command = new StringBuilder("7 iTime");
/*      */ 
/*  405 */     command.append(' ').append('[').append(symbol).append(']');
/*  406 */     command.append(' ').append('[').append(timeframe.val).append(']');
/*  407 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/*  409 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  410 */     int ix = result.indexOf('@');
/*  411 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  412 */     switch (error) { case 4066:
/*  413 */       throw new ErrHistoryWillUpdated();
/*      */     case 4106:
/*  414 */       throw new ErrUnknownSymbol();
/*      */     }
/*  416 */     if (error != 0) {
/*  417 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  421 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  426 */     long time = Long.parseLong(result) * 1000L;
/*  427 */     Date res = new Date(time + getTZCorrectionOffset(time));
/*  428 */     return res;
/*      */   }
/*      */ 
/*      */   public int iLowest(String symbol, Timeframe timeframe, Series type, int count, int start)
/*      */     throws ErrIncorrectSeriesarrayUsing, ErrHistoryWillUpdated, ErrUnknownSymbol
/*      */   {
/*  449 */     StringBuilder command = new StringBuilder("8 iLowest");
/*      */ 
/*  453 */     command.append(' ').append('[').append(symbol).append(']');
/*  454 */     command.append(' ').append('[').append(timeframe.val).append(']');
/*  455 */     command.append(' ').append('[').append(type.val).append(']');
/*  456 */     command.append(' ').append('[').append(count).append(']');
/*  457 */     command.append(' ').append('[').append(start).append(']');
/*      */ 
/*  459 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  460 */     int ix = result.indexOf('@');
/*  461 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  462 */     switch (error) { case 4054:
/*  463 */       throw new ErrIncorrectSeriesarrayUsing();
/*      */     case 4066:
/*  464 */       throw new ErrHistoryWillUpdated();
/*      */     case 4106:
/*  465 */       throw new ErrUnknownSymbol();
/*      */     }
/*  467 */     if (error != 0) {
/*  468 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  472 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  477 */     int res = Integer.parseInt(result);
/*  478 */     return res;
/*      */   }
/*      */ 
/*      */   public int iHighest(String symbol, Timeframe timeframe, Series type, int count, int start)
/*      */     throws ErrIncorrectSeriesarrayUsing, ErrHistoryWillUpdated, ErrUnknownSymbol
/*      */   {
/*  499 */     StringBuilder command = new StringBuilder("9 iHighest");
/*      */ 
/*  503 */     command.append(' ').append('[').append(symbol).append(']');
/*  504 */     command.append(' ').append('[').append(timeframe.val).append(']');
/*  505 */     command.append(' ').append('[').append(type.val).append(']');
/*  506 */     command.append(' ').append('[').append(count).append(']');
/*  507 */     command.append(' ').append('[').append(start).append(']');
/*      */ 
/*  509 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  510 */     int ix = result.indexOf('@');
/*  511 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  512 */     switch (error) { case 4054:
/*  513 */       throw new ErrIncorrectSeriesarrayUsing();
/*      */     case 4066:
/*  514 */       throw new ErrHistoryWillUpdated();
/*      */     case 4106:
/*  515 */       throw new ErrUnknownSymbol();
/*      */     }
/*  517 */     if (error != 0) {
/*  518 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  522 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  527 */     int res = Integer.parseInt(result);
/*  528 */     return res;
/*      */   }
/*      */ 
/*      */   public double accountBalance()
/*      */   {
/*  539 */     StringBuilder command = new StringBuilder("10 accountBalance");
/*      */ 
/*  545 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  546 */     int ix = result.indexOf('@');
/*  547 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  548 */     switch (error)
/*      */     {
/*      */     }
/*  551 */     if (error != 0) {
/*  552 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  556 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  561 */     double res = Double.parseDouble(result);
/*  562 */     return res;
/*      */   }
/*      */ 
/*      */   public double accountCredit()
/*      */   {
/*  573 */     StringBuilder command = new StringBuilder("11 accountCredit");
/*      */ 
/*  579 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  580 */     int ix = result.indexOf('@');
/*  581 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  582 */     switch (error)
/*      */     {
/*      */     }
/*  585 */     if (error != 0) {
/*  586 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  590 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  595 */     double res = Double.parseDouble(result);
/*  596 */     return res;
/*      */   }
/*      */ 
/*      */   public String accountCompany()
/*      */   {
/*  607 */     StringBuilder command = new StringBuilder("12 accountCompany");
/*      */ 
/*  613 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  614 */     int ix = result.indexOf('@');
/*  615 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  616 */     switch (error)
/*      */     {
/*      */     }
/*  619 */     if (error != 0) {
/*  620 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  624 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  629 */     String res = result;
/*  630 */     return res;
/*      */   }
/*      */ 
/*      */   public String accountCurrency()
/*      */   {
/*  641 */     StringBuilder command = new StringBuilder("13 accountCurrency");
/*      */ 
/*  647 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  648 */     int ix = result.indexOf('@');
/*  649 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  650 */     switch (error)
/*      */     {
/*      */     }
/*  653 */     if (error != 0) {
/*  654 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  658 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  663 */     String res = result;
/*  664 */     return res;
/*      */   }
/*      */ 
/*      */   public double accountEquity()
/*      */   {
/*  675 */     StringBuilder command = new StringBuilder("14 accountEquity");
/*      */ 
/*  681 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  682 */     int ix = result.indexOf('@');
/*  683 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  684 */     switch (error)
/*      */     {
/*      */     }
/*  687 */     if (error != 0) {
/*  688 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  692 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  697 */     double res = Double.parseDouble(result);
/*  698 */     return res;
/*      */   }
/*      */ 
/*      */   public double accountFreeMargin()
/*      */   {
/*  709 */     StringBuilder command = new StringBuilder("15 accountFreeMargin");
/*      */ 
/*  715 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  716 */     int ix = result.indexOf('@');
/*  717 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  718 */     switch (error)
/*      */     {
/*      */     }
/*  721 */     if (error != 0) {
/*  722 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  726 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  731 */     double res = Double.parseDouble(result);
/*  732 */     return res;
/*      */   }
/*      */ 
/*      */   public double accountMargin()
/*      */   {
/*  743 */     StringBuilder command = new StringBuilder("16 accountMargin");
/*      */ 
/*  749 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  750 */     int ix = result.indexOf('@');
/*  751 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  752 */     switch (error)
/*      */     {
/*      */     }
/*  755 */     if (error != 0) {
/*  756 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  760 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  765 */     double res = Double.parseDouble(result);
/*  766 */     return res;
/*      */   }
/*      */ 
/*      */   public String accountName()
/*      */   {
/*  777 */     StringBuilder command = new StringBuilder("17 accountName");
/*      */ 
/*  783 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  784 */     int ix = result.indexOf('@');
/*  785 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  786 */     switch (error)
/*      */     {
/*      */     }
/*  789 */     if (error != 0) {
/*  790 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  794 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  799 */     String res = result;
/*  800 */     return res;
/*      */   }
/*      */ 
/*      */   public int accountNumber()
/*      */   {
/*  811 */     StringBuilder command = new StringBuilder("18 accountNumber");
/*      */ 
/*  817 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  818 */     int ix = result.indexOf('@');
/*  819 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  820 */     switch (error)
/*      */     {
/*      */     }
/*  823 */     if (error != 0) {
/*  824 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  828 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  833 */     int res = Integer.parseInt(result);
/*  834 */     return res;
/*      */   }
/*      */ 
/*      */   public double accountProfit()
/*      */   {
/*  845 */     StringBuilder command = new StringBuilder("19 accountProfit");
/*      */ 
/*  851 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  852 */     int ix = result.indexOf('@');
/*  853 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  854 */     switch (error)
/*      */     {
/*      */     }
/*  857 */     if (error != 0) {
/*  858 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  862 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  867 */     double res = Double.parseDouble(result);
/*  868 */     return res;
/*      */   }
/*      */ 
/*      */   public int getLastError()
/*      */   {
/*  879 */     StringBuilder command = new StringBuilder("20 getLastError");
/*      */ 
/*  885 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  886 */     int ix = result.indexOf('@');
/*  887 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  888 */     switch (error)
/*      */     {
/*      */     }
/*  891 */     if (error != 0) {
/*  892 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  896 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  901 */     int res = Integer.parseInt(result);
/*  902 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean isConnected()
/*      */   {
/*  913 */     StringBuilder command = new StringBuilder("21 isConnected");
/*      */ 
/*  919 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  920 */     int ix = result.indexOf('@');
/*  921 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  922 */     switch (error)
/*      */     {
/*      */     }
/*  925 */     if (error != 0) {
/*  926 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  930 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  935 */     boolean res = Integer.parseInt(result) != 0;
/*  936 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean isDemo()
/*      */   {
/*  947 */     StringBuilder command = new StringBuilder("22 isDemo");
/*      */ 
/*  953 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  954 */     int ix = result.indexOf('@');
/*  955 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  956 */     switch (error)
/*      */     {
/*      */     }
/*  959 */     if (error != 0) {
/*  960 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  964 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/*  969 */     boolean res = Integer.parseInt(result) != 0;
/*  970 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean isTesting()
/*      */   {
/*  981 */     StringBuilder command = new StringBuilder("23 isTesting");
/*      */ 
/*  987 */     String result = this.strategyRunner.sendCommandGetResult(command);
/*  988 */     int ix = result.indexOf('@');
/*  989 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/*  990 */     switch (error)
/*      */     {
/*      */     }
/*  993 */     if (error != 0) {
/*  994 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/*  998 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1003 */     boolean res = Integer.parseInt(result) != 0;
/* 1004 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean isVisualMode()
/*      */   {
/* 1015 */     StringBuilder command = new StringBuilder("24 isVisualMode");
/*      */ 
/* 1021 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1022 */     int ix = result.indexOf('@');
/* 1023 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1024 */     switch (error)
/*      */     {
/*      */     }
/* 1027 */     if (error != 0) {
/* 1028 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1032 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1037 */     boolean res = Integer.parseInt(result) != 0;
/* 1038 */     return res;
/*      */   }
/*      */ 
/*      */   public int getTickCount()
/*      */   {
/* 1049 */     StringBuilder command = new StringBuilder("25 getTickCount");
/*      */ 
/* 1055 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1056 */     int ix = result.indexOf('@');
/* 1057 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1058 */     switch (error)
/*      */     {
/*      */     }
/* 1061 */     if (error != 0) {
/* 1062 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1066 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1071 */     int res = Integer.parseInt(result);
/* 1072 */     return res;
/*      */   }
/*      */ 
/*      */   public void comment(String comments)
/*      */   {
/* 1085 */     StringBuilder command = new StringBuilder("26 comment");
/*      */ 
/* 1089 */     command.append(' ').append('[').append(comments).append(']');
/*      */ 
/* 1091 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1092 */     int ix = result.indexOf('@');
/* 1093 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1094 */     switch (error)
/*      */     {
/*      */     }
/* 1097 */     if (error != 0) {
/* 1098 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1102 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */   }
/*      */ 
/*      */   public double marketInfo(String symbol, MarketInfo type)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 1123 */     StringBuilder command = new StringBuilder("27 marketInfo");
/*      */ 
/* 1127 */     command.append(' ').append('[').append(symbol).append(']');
/* 1128 */     command.append(' ').append('[').append(type.val).append(']');
/*      */ 
/* 1130 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1131 */     int ix = result.indexOf('@');
/* 1132 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1133 */     switch (error) { case 4106:
/* 1134 */       throw new ErrUnknownSymbol();
/*      */     }
/* 1136 */     if (error != 0) {
/* 1137 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1141 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1146 */     double res = Double.parseDouble(result);
/* 1147 */     return res;
/*      */   }
/*      */ 
/*      */   public void print(String comments)
/*      */   {
/* 1160 */     StringBuilder command = new StringBuilder("28 print");
/*      */ 
/* 1164 */     command.append(' ').append('[').append(comments).append(']');
/*      */ 
/* 1166 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1167 */     int ix = result.indexOf('@');
/* 1168 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1169 */     switch (error)
/*      */     {
/*      */     }
/* 1172 */     if (error != 0) {
/* 1173 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1177 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */   }
/*      */ 
/*      */   public int day()
/*      */   {
/* 1194 */     StringBuilder command = new StringBuilder("29 day");
/*      */ 
/* 1200 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1201 */     int ix = result.indexOf('@');
/* 1202 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1203 */     switch (error)
/*      */     {
/*      */     }
/* 1206 */     if (error != 0) {
/* 1207 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1211 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1216 */     int res = Integer.parseInt(result);
/* 1217 */     return res;
/*      */   }
/*      */ 
/*      */   public int dayOfWeek()
/*      */   {
/* 1228 */     StringBuilder command = new StringBuilder("30 dayOfWeek");
/*      */ 
/* 1234 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1235 */     int ix = result.indexOf('@');
/* 1236 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1237 */     switch (error)
/*      */     {
/*      */     }
/* 1240 */     if (error != 0) {
/* 1241 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1245 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1250 */     int res = Integer.parseInt(result);
/* 1251 */     return res;
/*      */   }
/*      */ 
/*      */   public int dayOfYear()
/*      */   {
/* 1262 */     StringBuilder command = new StringBuilder("31 dayOfYear");
/*      */ 
/* 1268 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1269 */     int ix = result.indexOf('@');
/* 1270 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1271 */     switch (error)
/*      */     {
/*      */     }
/* 1274 */     if (error != 0) {
/* 1275 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1279 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1284 */     int res = Integer.parseInt(result);
/* 1285 */     return res;
/*      */   }
/*      */ 
/*      */   public int hour()
/*      */   {
/* 1296 */     StringBuilder command = new StringBuilder("32 hour");
/*      */ 
/* 1302 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1303 */     int ix = result.indexOf('@');
/* 1304 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1305 */     switch (error)
/*      */     {
/*      */     }
/* 1308 */     if (error != 0) {
/* 1309 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1313 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1318 */     int res = Integer.parseInt(result);
/* 1319 */     return res;
/*      */   }
/*      */ 
/*      */   public int minute()
/*      */   {
/* 1330 */     StringBuilder command = new StringBuilder("33 minute");
/*      */ 
/* 1336 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1337 */     int ix = result.indexOf('@');
/* 1338 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1339 */     switch (error)
/*      */     {
/*      */     }
/* 1342 */     if (error != 0) {
/* 1343 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1347 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1352 */     int res = Integer.parseInt(result);
/* 1353 */     return res;
/*      */   }
/*      */ 
/*      */   public int month()
/*      */   {
/* 1364 */     StringBuilder command = new StringBuilder("34 month");
/*      */ 
/* 1370 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1371 */     int ix = result.indexOf('@');
/* 1372 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1373 */     switch (error)
/*      */     {
/*      */     }
/* 1376 */     if (error != 0) {
/* 1377 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1381 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1386 */     int res = Integer.parseInt(result);
/* 1387 */     return res;
/*      */   }
/*      */ 
/*      */   public int seconds()
/*      */   {
/* 1398 */     StringBuilder command = new StringBuilder("35 seconds");
/*      */ 
/* 1404 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1405 */     int ix = result.indexOf('@');
/* 1406 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1407 */     switch (error)
/*      */     {
/*      */     }
/* 1410 */     if (error != 0) {
/* 1411 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1415 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1420 */     int res = Integer.parseInt(result);
/* 1421 */     return res;
/*      */   }
/*      */ 
/*      */   public Date timeCurrent()
/*      */   {
/* 1432 */     StringBuilder command = new StringBuilder("36 timeCurrent");
/*      */ 
/* 1438 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1439 */     int ix = result.indexOf('@');
/* 1440 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1441 */     switch (error)
/*      */     {
/*      */     }
/* 1444 */     if (error != 0) {
/* 1445 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1449 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1454 */     long time = Long.parseLong(result) * 1000L;
/* 1455 */     Date res = new Date(time + getTZCorrectionOffset(time));
/* 1456 */     return res;
/*      */   }
/*      */ 
/*      */   public int year()
/*      */   {
/* 1467 */     StringBuilder command = new StringBuilder("37 year");
/*      */ 
/* 1473 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1474 */     int ix = result.indexOf('@');
/* 1475 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1476 */     switch (error)
/*      */     {
/*      */     }
/* 1479 */     if (error != 0) {
/* 1480 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1484 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1489 */     int res = Integer.parseInt(result);
/* 1490 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean objectCreate(String name, ObjectType type, int window, Date time1, double price1, Date time2, double price2, Date time3, double price3)
/*      */   {
/* 1519 */     StringBuilder command = new StringBuilder("38 objectCreate");
/*      */ 
/* 1523 */     command.append(' ').append('[').append(name).append(']');
/* 1524 */     command.append(' ').append('[').append(type.val).append(']');
/* 1525 */     command.append(' ').append('[').append(window).append(']');
/* 1526 */     command.append(' ').append('[').append(time1 == null ? "1970.01.01 00:00" : new SimpleDateFormat("yyyy.MM.dd HH:mm").format(time1)).append(']');
/* 1527 */     command.append(' ').append('[').append(price1).append(']');
/* 1528 */     command.append(' ').append('[').append(time2 == null ? "1970.01.01 00:00" : new SimpleDateFormat("yyyy.MM.dd HH:mm").format(time2)).append(']');
/* 1529 */     command.append(' ').append('[').append(price2).append(']');
/* 1530 */     command.append(' ').append('[').append(time3 == null ? "1970.01.01 00:00" : new SimpleDateFormat("yyyy.MM.dd HH:mm").format(time3)).append(']');
/* 1531 */     command.append(' ').append('[').append(price3).append(']');
/*      */ 
/* 1533 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1534 */     int ix = result.indexOf('@');
/* 1535 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1536 */     switch (error)
/*      */     {
/*      */     }
/* 1539 */     if (error != 0) {
/* 1540 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1544 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1549 */     boolean res = Integer.parseInt(result) != 0;
/* 1550 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean objectCreate(String name, ObjectType type, int window, Date time1, double price1)
/*      */   {
/* 1571 */     StringBuilder command = new StringBuilder("39 objectCreate");
/*      */ 
/* 1575 */     command.append(' ').append('[').append(name).append(']');
/* 1576 */     command.append(' ').append('[').append(type.val).append(']');
/* 1577 */     command.append(' ').append('[').append(window).append(']');
/* 1578 */     command.append(' ').append('[').append(time1 == null ? "1970.01.01 00:00" : new SimpleDateFormat("yyyy.MM.dd HH:mm").format(time1)).append(']');
/* 1579 */     command.append(' ').append('[').append(price1).append(']');
/*      */ 
/* 1581 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1582 */     int ix = result.indexOf('@');
/* 1583 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1584 */     switch (error)
/*      */     {
/*      */     }
/* 1587 */     if (error != 0) {
/* 1588 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1592 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1597 */     boolean res = Integer.parseInt(result) != 0;
/* 1598 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean objectCreate(String name, ObjectType type, int window, Date time1, double price1, Date time2, double price2)
/*      */   {
/* 1623 */     StringBuilder command = new StringBuilder("40 objectCreate");
/*      */ 
/* 1627 */     command.append(' ').append('[').append(name).append(']');
/* 1628 */     command.append(' ').append('[').append(type.val).append(']');
/* 1629 */     command.append(' ').append('[').append(window).append(']');
/* 1630 */     command.append(' ').append('[').append(time1 == null ? "1970.01.01 00:00" : new SimpleDateFormat("yyyy.MM.dd HH:mm").format(time1)).append(']');
/* 1631 */     command.append(' ').append('[').append(price1).append(']');
/* 1632 */     command.append(' ').append('[').append(time2 == null ? "1970.01.01 00:00" : new SimpleDateFormat("yyyy.MM.dd HH:mm").format(time2)).append(']');
/* 1633 */     command.append(' ').append('[').append(price2).append(']');
/*      */ 
/* 1635 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1636 */     int ix = result.indexOf('@');
/* 1637 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1638 */     switch (error)
/*      */     {
/*      */     }
/* 1641 */     if (error != 0) {
/* 1642 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1646 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1651 */     boolean res = Integer.parseInt(result) != 0;
/* 1652 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean objectDelete(String name)
/*      */   {
/* 1665 */     StringBuilder command = new StringBuilder("41 objectDelete");
/*      */ 
/* 1669 */     command.append(' ').append('[').append(name).append(']');
/*      */ 
/* 1671 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1672 */     int ix = result.indexOf('@');
/* 1673 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1674 */     switch (error)
/*      */     {
/*      */     }
/* 1677 */     if (error != 0) {
/* 1678 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1682 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1687 */     boolean res = Integer.parseInt(result) != 0;
/* 1688 */     return res;
/*      */   }
/*      */ 
/*      */   public double objectGet(String name, ObjectProperty index)
/*      */   {
/* 1703 */     StringBuilder command = new StringBuilder("42 objectGet");
/*      */ 
/* 1707 */     command.append(' ').append('[').append(name).append(']');
/* 1708 */     command.append(' ').append('[').append(index.val).append(']');
/*      */ 
/* 1710 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1711 */     int ix = result.indexOf('@');
/* 1712 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1713 */     switch (error)
/*      */     {
/*      */     }
/* 1716 */     if (error != 0) {
/* 1717 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1721 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1726 */     double res = Double.parseDouble(result);
/* 1727 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean objectSet(String name, ObjectProperty index, double value)
/*      */   {
/* 1744 */     StringBuilder command = new StringBuilder("43 objectSet");
/*      */ 
/* 1748 */     command.append(' ').append('[').append(name).append(']');
/* 1749 */     command.append(' ').append('[').append(index.val).append(']');
/* 1750 */     command.append(' ').append('[').append(value).append(']');
/*      */ 
/* 1752 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1753 */     int ix = result.indexOf('@');
/* 1754 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1755 */     switch (error)
/*      */     {
/*      */     }
/* 1758 */     if (error != 0) {
/* 1759 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1763 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1768 */     boolean res = Integer.parseInt(result) != 0;
/* 1769 */     return res;
/*      */   }
/*      */ 
/*      */   public String objectGetFiboDescription(String name, int index)
/*      */   {
/* 1784 */     StringBuilder command = new StringBuilder("44 objectGetFiboDescription");
/*      */ 
/* 1788 */     command.append(' ').append('[').append(name).append(']');
/* 1789 */     command.append(' ').append('[').append(index).append(']');
/*      */ 
/* 1791 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1792 */     int ix = result.indexOf('@');
/* 1793 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1794 */     switch (error)
/*      */     {
/*      */     }
/* 1797 */     if (error != 0) {
/* 1798 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1802 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1807 */     String res = result;
/* 1808 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean objectSetFiboDescription(String name, int index, String text)
/*      */   {
/* 1825 */     StringBuilder command = new StringBuilder("45 objectSetFiboDescription");
/*      */ 
/* 1829 */     command.append(' ').append('[').append(name).append(']');
/* 1830 */     command.append(' ').append('[').append(index).append(']');
/* 1831 */     command.append(' ').append('[').append(text).append(']');
/*      */ 
/* 1833 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1834 */     int ix = result.indexOf('@');
/* 1835 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1836 */     switch (error)
/*      */     {
/*      */     }
/* 1839 */     if (error != 0) {
/* 1840 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1844 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1849 */     boolean res = Integer.parseInt(result) != 0;
/* 1850 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean objectSetText(String name, String text, int font_size, String font, long text_color)
/*      */   {
/* 1871 */     StringBuilder command = new StringBuilder("46 objectSetText");
/*      */ 
/* 1875 */     command.append(' ').append('[').append(name).append(']');
/* 1876 */     command.append(' ').append('[').append(text).append(']');
/* 1877 */     command.append(' ').append('[').append(font_size).append(']');
/* 1878 */     command.append(' ').append('[').append(font).append(']');
/* 1879 */     command.append(' ').append('[').append(text_color).append(']');
/*      */ 
/* 1881 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1882 */     int ix = result.indexOf('@');
/* 1883 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1884 */     switch (error)
/*      */     {
/*      */     }
/* 1887 */     if (error != 0) {
/* 1888 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1892 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1897 */     boolean res = Integer.parseInt(result) != 0;
/* 1898 */     return res;
/*      */   }
/*      */ 
/*      */   public int objectsTotal(ObjectType type)
/*      */   {
/* 1911 */     StringBuilder command = new StringBuilder("47 objectsTotal");
/*      */ 
/* 1915 */     command.append(' ').append('[').append(type.val).append(']');
/*      */ 
/* 1917 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1918 */     int ix = result.indexOf('@');
/* 1919 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1920 */     switch (error)
/*      */     {
/*      */     }
/* 1923 */     if (error != 0) {
/* 1924 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1928 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1933 */     int res = Integer.parseInt(result);
/* 1934 */     return res;
/*      */   }
/*      */ 
/*      */   public int objectType(String name)
/*      */   {
/* 1947 */     StringBuilder command = new StringBuilder("48 objectType");
/*      */ 
/* 1951 */     command.append(' ').append('[').append(name).append(']');
/*      */ 
/* 1953 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1954 */     int ix = result.indexOf('@');
/* 1955 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1956 */     switch (error)
/*      */     {
/*      */     }
/* 1959 */     if (error != 0) {
/* 1960 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 1964 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 1969 */     int res = Integer.parseInt(result);
/* 1970 */     return res;
/*      */   }
/*      */ 
/*      */   public double iAC(String symbol, Timeframe timeframe, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 1987 */     StringBuilder command = new StringBuilder("49 iAC");
/*      */ 
/* 1991 */     command.append(' ').append('[').append(symbol).append(']');
/* 1992 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 1993 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 1995 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 1996 */     int ix = result.indexOf('@');
/* 1997 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 1998 */     switch (error) { case 4106:
/* 1999 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2001 */     if (error != 0) {
/* 2002 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2006 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2011 */     double res = Double.parseDouble(result);
/* 2012 */     return res;
/*      */   }
/*      */ 
/*      */   public double iAD(String symbol, Timeframe timeframe, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2029 */     StringBuilder command = new StringBuilder("50 iAD");
/*      */ 
/* 2033 */     command.append(' ').append('[').append(symbol).append(']');
/* 2034 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2035 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2037 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2038 */     int ix = result.indexOf('@');
/* 2039 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2040 */     switch (error) { case 4106:
/* 2041 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2043 */     if (error != 0) {
/* 2044 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2048 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2053 */     double res = Double.parseDouble(result);
/* 2054 */     return res;
/*      */   }
/*      */ 
/*      */   public double iAlligator(String symbol, Timeframe timeframe, int jawPeriod, int jawShift, int teethPeriod, int teethShift, int lipsPeriod, int lipsShift, MovingAverageMethod maMethod, AppliedPrice appliedPrice, GatorMode mode, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2089 */     StringBuilder command = new StringBuilder("51 iAlligator");
/*      */ 
/* 2093 */     command.append(' ').append('[').append(symbol).append(']');
/* 2094 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2095 */     command.append(' ').append('[').append(jawPeriod).append(']');
/* 2096 */     command.append(' ').append('[').append(jawShift).append(']');
/* 2097 */     command.append(' ').append('[').append(teethPeriod).append(']');
/* 2098 */     command.append(' ').append('[').append(teethShift).append(']');
/* 2099 */     command.append(' ').append('[').append(lipsPeriod).append(']');
/* 2100 */     command.append(' ').append('[').append(lipsShift).append(']');
/* 2101 */     command.append(' ').append('[').append(maMethod.val).append(']');
/* 2102 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 2103 */     command.append(' ').append('[').append(mode.val).append(']');
/* 2104 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2106 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2107 */     int ix = result.indexOf('@');
/* 2108 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2109 */     switch (error) { case 4106:
/* 2110 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2112 */     if (error != 0) {
/* 2113 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2117 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2122 */     double res = Double.parseDouble(result);
/* 2123 */     return res;
/*      */   }
/*      */ 
/*      */   public double iADX(String symbol, Timeframe timeframe, int period, AppliedPrice appliedPrice, ADXIndicatorLines mode, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2146 */     StringBuilder command = new StringBuilder("52 iADX");
/*      */ 
/* 2150 */     command.append(' ').append('[').append(symbol).append(']');
/* 2151 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2152 */     command.append(' ').append('[').append(period).append(']');
/* 2153 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 2154 */     command.append(' ').append('[').append(mode.val).append(']');
/* 2155 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2157 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2158 */     int ix = result.indexOf('@');
/* 2159 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2160 */     switch (error) { case 4106:
/* 2161 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2163 */     if (error != 0) {
/* 2164 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2168 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2173 */     double res = Double.parseDouble(result);
/* 2174 */     return res;
/*      */   }
/*      */ 
/*      */   public double iATR(String symbol, Timeframe timeframe, int period, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2193 */     StringBuilder command = new StringBuilder("53 iATR");
/*      */ 
/* 2197 */     command.append(' ').append('[').append(symbol).append(']');
/* 2198 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2199 */     command.append(' ').append('[').append(period).append(']');
/* 2200 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2202 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2203 */     int ix = result.indexOf('@');
/* 2204 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2205 */     switch (error) { case 4106:
/* 2206 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2208 */     if (error != 0) {
/* 2209 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2213 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2218 */     double res = Double.parseDouble(result);
/* 2219 */     return res;
/*      */   }
/*      */ 
/*      */   public double iAO(String symbol, Timeframe timeframe, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2236 */     StringBuilder command = new StringBuilder("54 iAO");
/*      */ 
/* 2240 */     command.append(' ').append('[').append(symbol).append(']');
/* 2241 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2242 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2244 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2245 */     int ix = result.indexOf('@');
/* 2246 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2247 */     switch (error) { case 4106:
/* 2248 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2250 */     if (error != 0) {
/* 2251 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2255 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2260 */     double res = Double.parseDouble(result);
/* 2261 */     return res;
/*      */   }
/*      */ 
/*      */   public double iBearsPower(String symbol, Timeframe timeframe, int period, AppliedPrice appliedPrice, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2282 */     StringBuilder command = new StringBuilder("55 iBearsPower");
/*      */ 
/* 2286 */     command.append(' ').append('[').append(symbol).append(']');
/* 2287 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2288 */     command.append(' ').append('[').append(period).append(']');
/* 2289 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 2290 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2292 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2293 */     int ix = result.indexOf('@');
/* 2294 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2295 */     switch (error) { case 4106:
/* 2296 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2298 */     if (error != 0) {
/* 2299 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2303 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2308 */     double res = Double.parseDouble(result);
/* 2309 */     return res;
/*      */   }
/*      */ 
/*      */   public double iBands(String symbol, Timeframe timeframe, int period, int deviation, int bandsShift, AppliedPrice appliedPrice, BandsIndicatorLines mode, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2336 */     StringBuilder command = new StringBuilder("56 iBands");
/*      */ 
/* 2340 */     command.append(' ').append('[').append(symbol).append(']');
/* 2341 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2342 */     command.append(' ').append('[').append(period).append(']');
/* 2343 */     command.append(' ').append('[').append(deviation).append(']');
/* 2344 */     command.append(' ').append('[').append(bandsShift).append(']');
/* 2345 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 2346 */     command.append(' ').append('[').append(mode.val).append(']');
/* 2347 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2349 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2350 */     int ix = result.indexOf('@');
/* 2351 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2352 */     switch (error) { case 4106:
/* 2353 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2355 */     if (error != 0) {
/* 2356 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2360 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2365 */     double res = Double.parseDouble(result);
/* 2366 */     return res;
/*      */   }
/*      */ 
/*      */   public double iBullsPower(String symbol, Timeframe timeframe, int period, AppliedPrice appliedPrice, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2387 */     StringBuilder command = new StringBuilder("57 iBullsPower");
/*      */ 
/* 2391 */     command.append(' ').append('[').append(symbol).append(']');
/* 2392 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2393 */     command.append(' ').append('[').append(period).append(']');
/* 2394 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 2395 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2397 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2398 */     int ix = result.indexOf('@');
/* 2399 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2400 */     switch (error) { case 4106:
/* 2401 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2403 */     if (error != 0) {
/* 2404 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2408 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2413 */     double res = Double.parseDouble(result);
/* 2414 */     return res;
/*      */   }
/*      */ 
/*      */   public double iCCI(String symbol, Timeframe timeframe, int period, AppliedPrice appliedPrice, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2435 */     StringBuilder command = new StringBuilder("58 iCCI");
/*      */ 
/* 2439 */     command.append(' ').append('[').append(symbol).append(']');
/* 2440 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2441 */     command.append(' ').append('[').append(period).append(']');
/* 2442 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 2443 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2445 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2446 */     int ix = result.indexOf('@');
/* 2447 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2448 */     switch (error) { case 4106:
/* 2449 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2451 */     if (error != 0) {
/* 2452 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2456 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2461 */     double res = Double.parseDouble(result);
/* 2462 */     return res;
/*      */   }
/*      */ 
/*      */   public double iCustom(String symbol, Timeframe timeframe, String name, int mode, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2483 */     StringBuilder command = new StringBuilder("59 iCustom");
/*      */ 
/* 2487 */     command.append(' ').append('[').append(symbol).append(']');
/* 2488 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2489 */     command.append(' ').append('[').append(name).append(']');
/* 2490 */     command.append(' ').append('[').append(mode).append(']');
/* 2491 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2493 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2494 */     int ix = result.indexOf('@');
/* 2495 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2496 */     switch (error) { case 4106:
/* 2497 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2499 */     if (error != 0) {
/* 2500 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2504 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2509 */     double res = Double.parseDouble(result);
/* 2510 */     return res;
/*      */   }
/*      */ 
/*      */   public double iDeMarker(String symbol, Timeframe timeframe, int period, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2529 */     StringBuilder command = new StringBuilder("60 iDeMarker");
/*      */ 
/* 2533 */     command.append(' ').append('[').append(symbol).append(']');
/* 2534 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2535 */     command.append(' ').append('[').append(period).append(']');
/* 2536 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2538 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2539 */     int ix = result.indexOf('@');
/* 2540 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2541 */     switch (error) { case 4106:
/* 2542 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2544 */     if (error != 0) {
/* 2545 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2549 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2554 */     double res = Double.parseDouble(result);
/* 2555 */     return res;
/*      */   }
/*      */ 
/*      */   public double iEnvelopes(String symbol, Timeframe timeframe, int maPeriod, MovingAverageMethod maMethod, int maShitf, AppliedPrice appliedPrice, double deviation, BandsIndicatorLines mode, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2584 */     StringBuilder command = new StringBuilder("61 iEnvelopes");
/*      */ 
/* 2588 */     command.append(' ').append('[').append(symbol).append(']');
/* 2589 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2590 */     command.append(' ').append('[').append(maPeriod).append(']');
/* 2591 */     command.append(' ').append('[').append(maMethod.val).append(']');
/* 2592 */     command.append(' ').append('[').append(maShitf).append(']');
/* 2593 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 2594 */     command.append(' ').append('[').append(deviation).append(']');
/* 2595 */     command.append(' ').append('[').append(mode.val).append(']');
/* 2596 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2598 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2599 */     int ix = result.indexOf('@');
/* 2600 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2601 */     switch (error) { case 4106:
/* 2602 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2604 */     if (error != 0) {
/* 2605 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2609 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2614 */     double res = Double.parseDouble(result);
/* 2615 */     return res;
/*      */   }
/*      */ 
/*      */   public double iForce(String symbol, Timeframe timeframe, int period, MovingAverageMethod maMethod, AppliedPrice appliedPrice, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2638 */     StringBuilder command = new StringBuilder("62 iForce");
/*      */ 
/* 2642 */     command.append(' ').append('[').append(symbol).append(']');
/* 2643 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2644 */     command.append(' ').append('[').append(period).append(']');
/* 2645 */     command.append(' ').append('[').append(maMethod.val).append(']');
/* 2646 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 2647 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2649 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2650 */     int ix = result.indexOf('@');
/* 2651 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2652 */     switch (error) { case 4106:
/* 2653 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2655 */     if (error != 0) {
/* 2656 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2660 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2665 */     double res = Double.parseDouble(result);
/* 2666 */     return res;
/*      */   }
/*      */ 
/*      */   public double iFractals(String symbol, Timeframe timeframe, BandsIndicatorLines mode, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2685 */     StringBuilder command = new StringBuilder("63 iFractals");
/*      */ 
/* 2689 */     command.append(' ').append('[').append(symbol).append(']');
/* 2690 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2691 */     command.append(' ').append('[').append(mode.val).append(']');
/* 2692 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2694 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2695 */     int ix = result.indexOf('@');
/* 2696 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2697 */     switch (error) { case 4106:
/* 2698 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2700 */     if (error != 0) {
/* 2701 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2705 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2710 */     double res = Double.parseDouble(result);
/* 2711 */     return res;
/*      */   }
/*      */ 
/*      */   public double iGator(String symbol, Timeframe timeframe, int jawPeriod, int jawShift, int teethPeriod, int teethShift, int lipsPeriod, int lipsShift, MovingAverageMethod maMethod, AppliedPrice appliedPrice, GatorMode mode, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2746 */     StringBuilder command = new StringBuilder("64 iGator");
/*      */ 
/* 2750 */     command.append(' ').append('[').append(symbol).append(']');
/* 2751 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2752 */     command.append(' ').append('[').append(jawPeriod).append(']');
/* 2753 */     command.append(' ').append('[').append(jawShift).append(']');
/* 2754 */     command.append(' ').append('[').append(teethPeriod).append(']');
/* 2755 */     command.append(' ').append('[').append(teethShift).append(']');
/* 2756 */     command.append(' ').append('[').append(lipsPeriod).append(']');
/* 2757 */     command.append(' ').append('[').append(lipsShift).append(']');
/* 2758 */     command.append(' ').append('[').append(maMethod.val).append(']');
/* 2759 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 2760 */     command.append(' ').append('[').append(mode.val).append(']');
/* 2761 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2763 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2764 */     int ix = result.indexOf('@');
/* 2765 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2766 */     switch (error) { case 4106:
/* 2767 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2769 */     if (error != 0) {
/* 2770 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2774 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2779 */     double res = Double.parseDouble(result);
/* 2780 */     return res;
/*      */   }
/*      */ 
/*      */   public double iBWMFI(String symbol, Timeframe timeframe, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2797 */     StringBuilder command = new StringBuilder("65 iBWMFI");
/*      */ 
/* 2801 */     command.append(' ').append('[').append(symbol).append(']');
/* 2802 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2803 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2805 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2806 */     int ix = result.indexOf('@');
/* 2807 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2808 */     switch (error) { case 4106:
/* 2809 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2811 */     if (error != 0) {
/* 2812 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2816 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2821 */     double res = Double.parseDouble(result);
/* 2822 */     return res;
/*      */   }
/*      */ 
/*      */   public double iMomentum(String symbol, Timeframe timeframe, int period, AppliedPrice appliedPrice, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2843 */     StringBuilder command = new StringBuilder("66 iMomentum");
/*      */ 
/* 2847 */     command.append(' ').append('[').append(symbol).append(']');
/* 2848 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2849 */     command.append(' ').append('[').append(period).append(']');
/* 2850 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 2851 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2853 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2854 */     int ix = result.indexOf('@');
/* 2855 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2856 */     switch (error) { case 4106:
/* 2857 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2859 */     if (error != 0) {
/* 2860 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2864 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2869 */     double res = Double.parseDouble(result);
/* 2870 */     return res;
/*      */   }
/*      */ 
/*      */   public double iMFI(String symbol, Timeframe timeframe, int period, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2889 */     StringBuilder command = new StringBuilder("67 iMFI");
/*      */ 
/* 2893 */     command.append(' ').append('[').append(symbol).append(']');
/* 2894 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2895 */     command.append(' ').append('[').append(period).append(']');
/* 2896 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2898 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2899 */     int ix = result.indexOf('@');
/* 2900 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2901 */     switch (error) { case 4106:
/* 2902 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2904 */     if (error != 0) {
/* 2905 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2909 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2914 */     double res = Double.parseDouble(result);
/* 2915 */     return res;
/*      */   }
/*      */ 
/*      */   public double iMA(String symbol, Timeframe timeframe, int period, int maShift, MovingAverageMethod maMethod, AppliedPrice appliedPrice, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2940 */     StringBuilder command = new StringBuilder("68 iMA");
/*      */ 
/* 2944 */     command.append(' ').append('[').append(symbol).append(']');
/* 2945 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 2946 */     command.append(' ').append('[').append(period).append(']');
/* 2947 */     command.append(' ').append('[').append(maShift).append(']');
/* 2948 */     command.append(' ').append('[').append(maMethod.val).append(']');
/* 2949 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 2950 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 2952 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 2953 */     int ix = result.indexOf('@');
/* 2954 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 2955 */     switch (error) { case 4106:
/* 2956 */       throw new ErrUnknownSymbol();
/*      */     }
/* 2958 */     if (error != 0) {
/* 2959 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 2963 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 2968 */     double res = Double.parseDouble(result);
/* 2969 */     return res;
/*      */   }
/*      */ 
/*      */   public double iOsMA(String symbol, Timeframe timeframe, int fastEMAPeriod, int slowEMAPeriod, int signalPeriod, AppliedPrice appliedPrice, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 2994 */     StringBuilder command = new StringBuilder("69 iOsMA");
/*      */ 
/* 2998 */     command.append(' ').append('[').append(symbol).append(']');
/* 2999 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 3000 */     command.append(' ').append('[').append(fastEMAPeriod).append(']');
/* 3001 */     command.append(' ').append('[').append(slowEMAPeriod).append(']');
/* 3002 */     command.append(' ').append('[').append(signalPeriod).append(']');
/* 3003 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 3004 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 3006 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3007 */     int ix = result.indexOf('@');
/* 3008 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3009 */     switch (error) { case 4106:
/* 3010 */       throw new ErrUnknownSymbol();
/*      */     }
/* 3012 */     if (error != 0) {
/* 3013 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3017 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3022 */     double res = Double.parseDouble(result);
/* 3023 */     return res;
/*      */   }
/*      */ 
/*      */   public double iMACD(String symbol, Timeframe timeframe, int fastEMAPeriod, int slowEMAPeriod, int signalPeriod, AppliedPrice appliedPrice, MACDIndicatorLines mode, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 3050 */     StringBuilder command = new StringBuilder("70 iMACD");
/*      */ 
/* 3054 */     command.append(' ').append('[').append(symbol).append(']');
/* 3055 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 3056 */     command.append(' ').append('[').append(fastEMAPeriod).append(']');
/* 3057 */     command.append(' ').append('[').append(slowEMAPeriod).append(']');
/* 3058 */     command.append(' ').append('[').append(signalPeriod).append(']');
/* 3059 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 3060 */     command.append(' ').append('[').append(mode.val).append(']');
/* 3061 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 3063 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3064 */     int ix = result.indexOf('@');
/* 3065 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3066 */     switch (error) { case 4106:
/* 3067 */       throw new ErrUnknownSymbol();
/*      */     }
/* 3069 */     if (error != 0) {
/* 3070 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3074 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3079 */     double res = Double.parseDouble(result);
/* 3080 */     return res;
/*      */   }
/*      */ 
/*      */   public double iOBV(String symbol, Timeframe timeframe, AppliedPrice appliedPrice, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 3099 */     StringBuilder command = new StringBuilder("71 iOBV");
/*      */ 
/* 3103 */     command.append(' ').append('[').append(symbol).append(']');
/* 3104 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 3105 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 3106 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 3108 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3109 */     int ix = result.indexOf('@');
/* 3110 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3111 */     switch (error) { case 4106:
/* 3112 */       throw new ErrUnknownSymbol();
/*      */     }
/* 3114 */     if (error != 0) {
/* 3115 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3119 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3124 */     double res = Double.parseDouble(result);
/* 3125 */     return res;
/*      */   }
/*      */ 
/*      */   public double iSAR(String symbol, Timeframe timeframe, double step, double maximum, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 3146 */     StringBuilder command = new StringBuilder("72 iSAR");
/*      */ 
/* 3150 */     command.append(' ').append('[').append(symbol).append(']');
/* 3151 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 3152 */     command.append(' ').append('[').append(step).append(']');
/* 3153 */     command.append(' ').append('[').append(maximum).append(']');
/* 3154 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 3156 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3157 */     int ix = result.indexOf('@');
/* 3158 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3159 */     switch (error) { case 4106:
/* 3160 */       throw new ErrUnknownSymbol();
/*      */     }
/* 3162 */     if (error != 0) {
/* 3163 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3167 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3172 */     double res = Double.parseDouble(result);
/* 3173 */     return res;
/*      */   }
/*      */ 
/*      */   public double iRSI(String symbol, Timeframe timeframe, int period, AppliedPrice appliedPrice, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 3194 */     StringBuilder command = new StringBuilder("73 iRSI");
/*      */ 
/* 3198 */     command.append(' ').append('[').append(symbol).append(']');
/* 3199 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 3200 */     command.append(' ').append('[').append(period).append(']');
/* 3201 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 3202 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 3204 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3205 */     int ix = result.indexOf('@');
/* 3206 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3207 */     switch (error) { case 4106:
/* 3208 */       throw new ErrUnknownSymbol();
/*      */     }
/* 3210 */     if (error != 0) {
/* 3211 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3215 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3220 */     double res = Double.parseDouble(result);
/* 3221 */     return res;
/*      */   }
/*      */ 
/*      */   public double iRVI(String symbol, Timeframe timeframe, int period, MACDIndicatorLines mode, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 3242 */     StringBuilder command = new StringBuilder("74 iRVI");
/*      */ 
/* 3246 */     command.append(' ').append('[').append(symbol).append(']');
/* 3247 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 3248 */     command.append(' ').append('[').append(period).append(']');
/* 3249 */     command.append(' ').append('[').append(mode.val).append(']');
/* 3250 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 3252 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3253 */     int ix = result.indexOf('@');
/* 3254 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3255 */     switch (error) { case 4106:
/* 3256 */       throw new ErrUnknownSymbol();
/*      */     }
/* 3258 */     if (error != 0) {
/* 3259 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3263 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3268 */     double res = Double.parseDouble(result);
/* 3269 */     return res;
/*      */   }
/*      */ 
/*      */   public double iStdDev(String symbol, Timeframe timeframe, int maPeriod, int maShift, MovingAverageMethod maMethod, AppliedPrice appliedPrice, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 3294 */     StringBuilder command = new StringBuilder("75 iStdDev");
/*      */ 
/* 3298 */     command.append(' ').append('[').append(symbol).append(']');
/* 3299 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 3300 */     command.append(' ').append('[').append(maPeriod).append(']');
/* 3301 */     command.append(' ').append('[').append(maShift).append(']');
/* 3302 */     command.append(' ').append('[').append(maMethod.val).append(']');
/* 3303 */     command.append(' ').append('[').append(appliedPrice.val).append(']');
/* 3304 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 3306 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3307 */     int ix = result.indexOf('@');
/* 3308 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3309 */     switch (error) { case 4106:
/* 3310 */       throw new ErrUnknownSymbol();
/*      */     }
/* 3312 */     if (error != 0) {
/* 3313 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3317 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3322 */     double res = Double.parseDouble(result);
/* 3323 */     return res;
/*      */   }
/*      */ 
/*      */   public double iStochastic(String symbol, Timeframe timeframe, int kPeriod, int dPeriod, int slowing, MovingAverageMethod maMethod, int priceField, MACDIndicatorLines mode, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 3352 */     StringBuilder command = new StringBuilder("76 iStochastic");
/*      */ 
/* 3356 */     command.append(' ').append('[').append(symbol).append(']');
/* 3357 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 3358 */     command.append(' ').append('[').append(kPeriod).append(']');
/* 3359 */     command.append(' ').append('[').append(dPeriod).append(']');
/* 3360 */     command.append(' ').append('[').append(slowing).append(']');
/* 3361 */     command.append(' ').append('[').append(maMethod.val).append(']');
/* 3362 */     command.append(' ').append('[').append(priceField).append(']');
/* 3363 */     command.append(' ').append('[').append(mode.val).append(']');
/* 3364 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 3366 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3367 */     int ix = result.indexOf('@');
/* 3368 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3369 */     switch (error) { case 4106:
/* 3370 */       throw new ErrUnknownSymbol();
/*      */     }
/* 3372 */     if (error != 0) {
/* 3373 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3377 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3382 */     double res = Double.parseDouble(result);
/* 3383 */     return res;
/*      */   }
/*      */ 
/*      */   public double iWPR(String symbol, Timeframe timeframe, int period, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 3402 */     StringBuilder command = new StringBuilder("77 iWPR");
/*      */ 
/* 3406 */     command.append(' ').append('[').append(symbol).append(']');
/* 3407 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 3408 */     command.append(' ').append('[').append(period).append(']');
/* 3409 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 3411 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3412 */     int ix = result.indexOf('@');
/* 3413 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3414 */     switch (error) { case 4106:
/* 3415 */       throw new ErrUnknownSymbol();
/*      */     }
/* 3417 */     if (error != 0) {
/* 3418 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3422 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3427 */     double res = Double.parseDouble(result);
/* 3428 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean orderClose(int ticket, double lots, double price, int slippage, long arrowColor)
/*      */     throws ErrCustomIndicatorError, ErrIntegerParameterExpected, ErrInvalidFunctionParamvalue, ErrInvalidPriceParam, ErrInvalidTicket, ErrUnknownSymbol, ErrTradeNotAllowed, ErrCommonError, ErrInvalidTradeParameters, ErrServerBusy, ErrOldVersion, ErrNoConnection, ErrTooFrequentRequests, ErrAccountDisabled, ErrInvalidAccount, ErrTradeTimeout, ErrInvalidPrice, ErrInvalidStops, ErrInvalidTradeVolume, ErrMarketClosed, ErrTradeDisabled, ErrNotEnoughMoney, ErrPriceChanged, ErrOffQuotes, ErrRequote, ErrOrderLocked, ErrLongPositionsOnlyAllowed, ErrTooManyRequests, ErrTradeTimeout2, ErrTradeTimeout3, ErrTradeTimeout4, ErrTradeModifyDenied, ErrTradeContextBusy, ErrTradeExpirationDenied, ErrTradeTooManyOrders
/*      */   {
/* 3449 */     StringBuilder command = new StringBuilder("78 orderClose");
/*      */ 
/* 3453 */     command.append(' ').append('[').append(ticket).append(']');
/* 3454 */     command.append(' ').append('[').append(lots).append(']');
/* 3455 */     command.append(' ').append('[').append(price).append(']');
/* 3456 */     command.append(' ').append('[').append(slippage).append(']');
/* 3457 */     command.append(' ').append('[').append(arrowColor).append(']');
/*      */ 
/* 3459 */     String result = (this.ordersProcessingChannel == null ? this.strategyRunner : this.ordersProcessingChannel).sendCommandGetResult(command);
/* 3460 */     int ix = result.indexOf('@');
/* 3461 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3462 */     switch (error) { case 4055:
/* 3463 */       throw new ErrCustomIndicatorError();
/*      */     case 4063:
/* 3464 */       throw new ErrIntegerParameterExpected();
/*      */     case 4051:
/* 3465 */       throw new ErrInvalidFunctionParamvalue();
/*      */     case 4107:
/* 3466 */       throw new ErrInvalidPriceParam();
/*      */     case 4108:
/* 3467 */       throw new ErrInvalidTicket();
/*      */     case 4106:
/* 3468 */       throw new ErrUnknownSymbol();
/*      */     case 4109:
/* 3469 */       throw new ErrTradeNotAllowed();
/*      */     case 0:
/* 3470 */       break;
/*      */     case 2:
/* 3471 */       throw new ErrCommonError();
/*      */     case 3:
/* 3472 */       throw new ErrInvalidTradeParameters();
/*      */     case 4:
/* 3473 */       throw new ErrServerBusy();
/*      */     case 5:
/* 3474 */       throw new ErrOldVersion();
/*      */     case 6:
/* 3475 */       throw new ErrNoConnection();
/*      */     case 8:
/* 3476 */       throw new ErrTooFrequentRequests();
/*      */     case 64:
/* 3477 */       throw new ErrAccountDisabled();
/*      */     case 65:
/* 3478 */       throw new ErrInvalidAccount();
/*      */     case 128:
/* 3479 */       throw new ErrTradeTimeout();
/*      */     case 129:
/* 3480 */       throw new ErrInvalidPrice();
/*      */     case 130:
/* 3481 */       throw new ErrInvalidStops();
/*      */     case 131:
/* 3482 */       throw new ErrInvalidTradeVolume();
/*      */     case 132:
/* 3483 */       throw new ErrMarketClosed();
/*      */     case 133:
/* 3484 */       throw new ErrTradeDisabled();
/*      */     case 134:
/* 3485 */       throw new ErrNotEnoughMoney();
/*      */     case 135:
/* 3486 */       throw new ErrPriceChanged();
/*      */     case 136:
/* 3487 */       throw new ErrOffQuotes();
/*      */     case 138:
/* 3488 */       throw new ErrRequote();
/*      */     case 139:
/* 3489 */       throw new ErrOrderLocked();
/*      */     case 140:
/* 3490 */       throw new ErrLongPositionsOnlyAllowed();
/*      */     case 141:
/* 3491 */       throw new ErrTooManyRequests();
/*      */     case 142:
/* 3492 */       throw new ErrTradeTimeout2();
/*      */     case 143:
/* 3493 */       throw new ErrTradeTimeout3();
/*      */     case 144:
/* 3494 */       throw new ErrTradeTimeout4();
/*      */     case 145:
/* 3495 */       throw new ErrTradeModifyDenied();
/*      */     case 146:
/* 3496 */       throw new ErrTradeContextBusy();
/*      */     case 147:
/* 3497 */       throw new ErrTradeExpirationDenied();
/*      */     case 148:
/* 3498 */       throw new ErrTradeTooManyOrders();
/*      */     default:
/* 3500 */       if (error == 0) break;
/* 3501 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3505 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3510 */     boolean res = Integer.parseInt(result) != 0;
/* 3511 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean orderCloseBy(int ticket, int opposite, long arrowColor)
/*      */     throws ErrCustomIndicatorError, ErrIntegerParameterExpected, ErrInvalidFunctionParamvalue, ErrInvalidTicket, ErrUnknownSymbol, ErrTradeNotAllowed, ErrCommonError, ErrInvalidTradeParameters, ErrServerBusy, ErrOldVersion, ErrNoConnection, ErrTooFrequentRequests, ErrAccountDisabled, ErrInvalidAccount, ErrTradeTimeout, ErrInvalidPrice, ErrInvalidStops, ErrInvalidTradeVolume, ErrMarketClosed, ErrTradeDisabled, ErrNotEnoughMoney, ErrPriceChanged, ErrOffQuotes, ErrRequote, ErrOrderLocked, ErrLongPositionsOnlyAllowed, ErrTooManyRequests, ErrTradeTimeout2, ErrTradeTimeout3, ErrTradeTimeout4, ErrTradeModifyDenied, ErrTradeContextBusy, ErrTradeExpirationDenied, ErrTradeTooManyOrders
/*      */   {
/* 3528 */     StringBuilder command = new StringBuilder("79 orderCloseBy");
/*      */ 
/* 3532 */     command.append(' ').append('[').append(ticket).append(']');
/* 3533 */     command.append(' ').append('[').append(opposite).append(']');
/* 3534 */     command.append(' ').append('[').append(arrowColor).append(']');
/*      */ 
/* 3536 */     String result = (this.ordersProcessingChannel == null ? this.strategyRunner : this.ordersProcessingChannel).sendCommandGetResult(command);
/* 3537 */     int ix = result.indexOf('@');
/* 3538 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3539 */     switch (error) { case 4055:
/* 3540 */       throw new ErrCustomIndicatorError();
/*      */     case 4063:
/* 3541 */       throw new ErrIntegerParameterExpected();
/*      */     case 4051:
/* 3542 */       throw new ErrInvalidFunctionParamvalue();
/*      */     case 4108:
/* 3543 */       throw new ErrInvalidTicket();
/*      */     case 4106:
/* 3544 */       throw new ErrUnknownSymbol();
/*      */     case 4109:
/* 3545 */       throw new ErrTradeNotAllowed();
/*      */     case 0:
/* 3546 */       break;
/*      */     case 2:
/* 3547 */       throw new ErrCommonError();
/*      */     case 3:
/* 3548 */       throw new ErrInvalidTradeParameters();
/*      */     case 4:
/* 3549 */       throw new ErrServerBusy();
/*      */     case 5:
/* 3550 */       throw new ErrOldVersion();
/*      */     case 6:
/* 3551 */       throw new ErrNoConnection();
/*      */     case 8:
/* 3552 */       throw new ErrTooFrequentRequests();
/*      */     case 64:
/* 3553 */       throw new ErrAccountDisabled();
/*      */     case 65:
/* 3554 */       throw new ErrInvalidAccount();
/*      */     case 128:
/* 3555 */       throw new ErrTradeTimeout();
/*      */     case 129:
/* 3556 */       throw new ErrInvalidPrice();
/*      */     case 130:
/* 3557 */       throw new ErrInvalidStops();
/*      */     case 131:
/* 3558 */       throw new ErrInvalidTradeVolume();
/*      */     case 132:
/* 3559 */       throw new ErrMarketClosed();
/*      */     case 133:
/* 3560 */       throw new ErrTradeDisabled();
/*      */     case 134:
/* 3561 */       throw new ErrNotEnoughMoney();
/*      */     case 135:
/* 3562 */       throw new ErrPriceChanged();
/*      */     case 136:
/* 3563 */       throw new ErrOffQuotes();
/*      */     case 138:
/* 3564 */       throw new ErrRequote();
/*      */     case 139:
/* 3565 */       throw new ErrOrderLocked();
/*      */     case 140:
/* 3566 */       throw new ErrLongPositionsOnlyAllowed();
/*      */     case 141:
/* 3567 */       throw new ErrTooManyRequests();
/*      */     case 142:
/* 3568 */       throw new ErrTradeTimeout2();
/*      */     case 143:
/* 3569 */       throw new ErrTradeTimeout3();
/*      */     case 144:
/* 3570 */       throw new ErrTradeTimeout4();
/*      */     case 145:
/* 3571 */       throw new ErrTradeModifyDenied();
/*      */     case 146:
/* 3572 */       throw new ErrTradeContextBusy();
/*      */     case 147:
/* 3573 */       throw new ErrTradeExpirationDenied();
/*      */     case 148:
/* 3574 */       throw new ErrTradeTooManyOrders();
/*      */     default:
/* 3576 */       if (error == 0) break;
/* 3577 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3581 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3586 */     boolean res = Integer.parseInt(result) != 0;
/* 3587 */     return res;
/*      */   }
/*      */ 
/*      */   public double orderClosePrice()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 3598 */     StringBuilder command = new StringBuilder("80 orderClosePrice");
/*      */ 
/* 3604 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3605 */     int ix = result.indexOf('@');
/* 3606 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3607 */     switch (error) { case 4105:
/* 3608 */       throw new ErrNoOrderSelected();
/*      */     }
/* 3610 */     if (error != 0) {
/* 3611 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3615 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3620 */     double res = Double.parseDouble(result);
/* 3621 */     return res;
/*      */   }
/*      */ 
/*      */   public Date orderCloseTime()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 3632 */     StringBuilder command = new StringBuilder("81 orderCloseTime");
/*      */ 
/* 3638 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3639 */     int ix = result.indexOf('@');
/* 3640 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3641 */     switch (error) { case 4105:
/* 3642 */       throw new ErrNoOrderSelected();
/*      */     }
/* 3644 */     if (error != 0) {
/* 3645 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3649 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3654 */     long time = Long.parseLong(result) * 1000L;
/* 3655 */     Date res = new Date(time + getTZCorrectionOffset(time));
/* 3656 */     return res;
/*      */   }
/*      */ 
/*      */   public String orderComment()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 3667 */     StringBuilder command = new StringBuilder("82 orderComment");
/*      */ 
/* 3673 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3674 */     int ix = result.indexOf('@');
/* 3675 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3676 */     switch (error) { case 4105:
/* 3677 */       throw new ErrNoOrderSelected();
/*      */     }
/* 3679 */     if (error != 0) {
/* 3680 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3684 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3689 */     String res = result;
/* 3690 */     return res;
/*      */   }
/*      */ 
/*      */   public double orderCommission()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 3701 */     StringBuilder command = new StringBuilder("83 orderCommission");
/*      */ 
/* 3707 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3708 */     int ix = result.indexOf('@');
/* 3709 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3710 */     switch (error) { case 4105:
/* 3711 */       throw new ErrNoOrderSelected();
/*      */     }
/* 3713 */     if (error != 0) {
/* 3714 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3718 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3723 */     double res = Double.parseDouble(result);
/* 3724 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean orderDelete(int ticket, long arrowColor)
/*      */     throws ErrCustomIndicatorError, ErrInvalidFunctionParamvalue, ErrInvalidTicket, ErrUnknownSymbol, ErrTradeNotAllowed, ErrCommonError, ErrInvalidTradeParameters, ErrServerBusy, ErrOldVersion, ErrNoConnection, ErrTooFrequentRequests, ErrAccountDisabled, ErrInvalidAccount, ErrTradeTimeout, ErrInvalidPrice, ErrInvalidStops, ErrInvalidTradeVolume, ErrMarketClosed, ErrTradeDisabled, ErrNotEnoughMoney, ErrPriceChanged, ErrOffQuotes, ErrRequote, ErrOrderLocked, ErrLongPositionsOnlyAllowed, ErrTooManyRequests, ErrTradeTimeout2, ErrTradeTimeout3, ErrTradeTimeout4, ErrTradeModifyDenied, ErrTradeContextBusy, ErrTradeExpirationDenied, ErrTradeTooManyOrders
/*      */   {
/* 3739 */     StringBuilder command = new StringBuilder("84 orderDelete");
/*      */ 
/* 3743 */     command.append(' ').append('[').append(ticket).append(']');
/* 3744 */     command.append(' ').append('[').append(arrowColor).append(']');
/*      */ 
/* 3746 */     String result = (this.ordersProcessingChannel == null ? this.strategyRunner : this.ordersProcessingChannel).sendCommandGetResult(command);
/* 3747 */     int ix = result.indexOf('@');
/* 3748 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3749 */     switch (error) { case 4055:
/* 3750 */       throw new ErrCustomIndicatorError();
/*      */     case 4051:
/* 3751 */       throw new ErrInvalidFunctionParamvalue();
/*      */     case 4108:
/* 3752 */       throw new ErrInvalidTicket();
/*      */     case 4106:
/* 3753 */       throw new ErrUnknownSymbol();
/*      */     case 4109:
/* 3754 */       throw new ErrTradeNotAllowed();
/*      */     case 0:
/* 3755 */       break;
/*      */     case 2:
/* 3756 */       throw new ErrCommonError();
/*      */     case 3:
/* 3757 */       throw new ErrInvalidTradeParameters();
/*      */     case 4:
/* 3758 */       throw new ErrServerBusy();
/*      */     case 5:
/* 3759 */       throw new ErrOldVersion();
/*      */     case 6:
/* 3760 */       throw new ErrNoConnection();
/*      */     case 8:
/* 3761 */       throw new ErrTooFrequentRequests();
/*      */     case 64:
/* 3762 */       throw new ErrAccountDisabled();
/*      */     case 65:
/* 3763 */       throw new ErrInvalidAccount();
/*      */     case 128:
/* 3764 */       throw new ErrTradeTimeout();
/*      */     case 129:
/* 3765 */       throw new ErrInvalidPrice();
/*      */     case 130:
/* 3766 */       throw new ErrInvalidStops();
/*      */     case 131:
/* 3767 */       throw new ErrInvalidTradeVolume();
/*      */     case 132:
/* 3768 */       throw new ErrMarketClosed();
/*      */     case 133:
/* 3769 */       throw new ErrTradeDisabled();
/*      */     case 134:
/* 3770 */       throw new ErrNotEnoughMoney();
/*      */     case 135:
/* 3771 */       throw new ErrPriceChanged();
/*      */     case 136:
/* 3772 */       throw new ErrOffQuotes();
/*      */     case 138:
/* 3773 */       throw new ErrRequote();
/*      */     case 139:
/* 3774 */       throw new ErrOrderLocked();
/*      */     case 140:
/* 3775 */       throw new ErrLongPositionsOnlyAllowed();
/*      */     case 141:
/* 3776 */       throw new ErrTooManyRequests();
/*      */     case 142:
/* 3777 */       throw new ErrTradeTimeout2();
/*      */     case 143:
/* 3778 */       throw new ErrTradeTimeout3();
/*      */     case 144:
/* 3779 */       throw new ErrTradeTimeout4();
/*      */     case 145:
/* 3780 */       throw new ErrTradeModifyDenied();
/*      */     case 146:
/* 3781 */       throw new ErrTradeContextBusy();
/*      */     case 147:
/* 3782 */       throw new ErrTradeExpirationDenied();
/*      */     case 148:
/* 3783 */       throw new ErrTradeTooManyOrders();
/*      */     default:
/* 3785 */       if (error == 0) break;
/* 3786 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3790 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3795 */     boolean res = Integer.parseInt(result) != 0;
/* 3796 */     return res;
/*      */   }
/*      */ 
/*      */   public double orderExpiration()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 3807 */     StringBuilder command = new StringBuilder("85 orderExpiration");
/*      */ 
/* 3813 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3814 */     int ix = result.indexOf('@');
/* 3815 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3816 */     switch (error) { case 4105:
/* 3817 */       throw new ErrNoOrderSelected();
/*      */     }
/* 3819 */     if (error != 0) {
/* 3820 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3824 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3829 */     double res = Double.parseDouble(result);
/* 3830 */     return res;
/*      */   }
/*      */ 
/*      */   public double orderLots()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 3841 */     StringBuilder command = new StringBuilder("86 orderLots");
/*      */ 
/* 3847 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3848 */     int ix = result.indexOf('@');
/* 3849 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3850 */     switch (error) { case 4105:
/* 3851 */       throw new ErrNoOrderSelected();
/*      */     }
/* 3853 */     if (error != 0) {
/* 3854 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3858 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3863 */     double res = Double.parseDouble(result);
/* 3864 */     return res;
/*      */   }
/*      */ 
/*      */   public int orderMagicNumber()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 3875 */     StringBuilder command = new StringBuilder("87 orderMagicNumber");
/*      */ 
/* 3881 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 3882 */     int ix = result.indexOf('@');
/* 3883 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3884 */     switch (error) { case 4105:
/* 3885 */       throw new ErrNoOrderSelected();
/*      */     }
/* 3887 */     if (error != 0) {
/* 3888 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3892 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3897 */     int res = Integer.parseInt(result);
/* 3898 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean orderModify(int ticket, double price, double stoploss, double takeprofit, Date expiration, long arrowColor)
/*      */     throws ErrCustomIndicatorError, ErrIntegerParameterExpected, ErrInvalidFunctionParamvalue, ErrInvalidPriceParam, ErrInvalidTicket, ErrUnknownSymbol, ErrTradeNotAllowed, ErrNoResult, ErrCommonError, ErrInvalidTradeParameters, ErrServerBusy, ErrOldVersion, ErrNoConnection, ErrTooFrequentRequests, ErrAccountDisabled, ErrInvalidAccount, ErrTradeTimeout, ErrInvalidPrice, ErrInvalidStops, ErrInvalidTradeVolume, ErrMarketClosed, ErrTradeDisabled, ErrNotEnoughMoney, ErrPriceChanged, ErrOffQuotes, ErrRequote, ErrOrderLocked, ErrLongPositionsOnlyAllowed, ErrTooManyRequests, ErrTradeTimeout2, ErrTradeTimeout3, ErrTradeTimeout4, ErrTradeModifyDenied, ErrTradeContextBusy, ErrTradeExpirationDenied, ErrTradeTooManyOrders
/*      */   {
/* 3921 */     StringBuilder command = new StringBuilder("88 orderModify");
/*      */ 
/* 3925 */     command.append(' ').append('[').append(ticket).append(']');
/* 3926 */     command.append(' ').append('[').append(price).append(']');
/* 3927 */     command.append(' ').append('[').append(stoploss).append(']');
/* 3928 */     command.append(' ').append('[').append(takeprofit).append(']');
/* 3929 */     command.append(' ').append('[').append(expiration == null ? "1970.01.01 00:00" : new SimpleDateFormat("yyyy.MM.dd HH:mm").format(expiration)).append(']');
/* 3930 */     command.append(' ').append('[').append(arrowColor).append(']');
/*      */ 
/* 3932 */     String result = (this.ordersProcessingChannel == null ? this.strategyRunner : this.ordersProcessingChannel).sendCommandGetResult(command);
/* 3933 */     int ix = result.indexOf('@');
/* 3934 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 3935 */     switch (error) { case 4055:
/* 3936 */       throw new ErrCustomIndicatorError();
/*      */     case 4063:
/* 3937 */       throw new ErrIntegerParameterExpected();
/*      */     case 4051:
/* 3938 */       throw new ErrInvalidFunctionParamvalue();
/*      */     case 4107:
/* 3939 */       throw new ErrInvalidPriceParam();
/*      */     case 4108:
/* 3940 */       throw new ErrInvalidTicket();
/*      */     case 4106:
/* 3941 */       throw new ErrUnknownSymbol();
/*      */     case 4109:
/* 3942 */       throw new ErrTradeNotAllowed();
/*      */     case 1:
/* 3943 */       throw new ErrNoResult();
/*      */     case 0:
/* 3944 */       break;
/*      */     case 2:
/* 3945 */       throw new ErrCommonError();
/*      */     case 3:
/* 3946 */       throw new ErrInvalidTradeParameters();
/*      */     case 4:
/* 3947 */       throw new ErrServerBusy();
/*      */     case 5:
/* 3948 */       throw new ErrOldVersion();
/*      */     case 6:
/* 3949 */       throw new ErrNoConnection();
/*      */     case 8:
/* 3950 */       throw new ErrTooFrequentRequests();
/*      */     case 64:
/* 3951 */       throw new ErrAccountDisabled();
/*      */     case 65:
/* 3952 */       throw new ErrInvalidAccount();
/*      */     case 128:
/* 3953 */       throw new ErrTradeTimeout();
/*      */     case 129:
/* 3954 */       throw new ErrInvalidPrice();
/*      */     case 130:
/* 3955 */       throw new ErrInvalidStops();
/*      */     case 131:
/* 3956 */       throw new ErrInvalidTradeVolume();
/*      */     case 132:
/* 3957 */       throw new ErrMarketClosed();
/*      */     case 133:
/* 3958 */       throw new ErrTradeDisabled();
/*      */     case 134:
/* 3959 */       throw new ErrNotEnoughMoney();
/*      */     case 135:
/* 3960 */       throw new ErrPriceChanged();
/*      */     case 136:
/* 3961 */       throw new ErrOffQuotes();
/*      */     case 138:
/* 3962 */       throw new ErrRequote();
/*      */     case 139:
/* 3963 */       throw new ErrOrderLocked();
/*      */     case 140:
/* 3964 */       throw new ErrLongPositionsOnlyAllowed();
/*      */     case 141:
/* 3965 */       throw new ErrTooManyRequests();
/*      */     case 142:
/* 3966 */       throw new ErrTradeTimeout2();
/*      */     case 143:
/* 3967 */       throw new ErrTradeTimeout3();
/*      */     case 144:
/* 3968 */       throw new ErrTradeTimeout4();
/*      */     case 145:
/* 3969 */       throw new ErrTradeModifyDenied();
/*      */     case 146:
/* 3970 */       throw new ErrTradeContextBusy();
/*      */     case 147:
/* 3971 */       throw new ErrTradeExpirationDenied();
/*      */     case 148:
/* 3972 */       throw new ErrTradeTooManyOrders();
/*      */     default:
/* 3974 */       if (error == 0) break;
/* 3975 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 3979 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 3984 */     boolean res = Integer.parseInt(result) != 0;
/* 3985 */     return res;
/*      */   }
/*      */ 
/*      */   public double orderOpenPrice()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 3996 */     StringBuilder command = new StringBuilder("89 orderOpenPrice");
/*      */ 
/* 4002 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4003 */     int ix = result.indexOf('@');
/* 4004 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4005 */     switch (error) { case 4105:
/* 4006 */       throw new ErrNoOrderSelected();
/*      */     }
/* 4008 */     if (error != 0) {
/* 4009 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4013 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4018 */     double res = Double.parseDouble(result);
/* 4019 */     return res;
/*      */   }
/*      */ 
/*      */   public Date orderOpenTime()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 4030 */     StringBuilder command = new StringBuilder("90 orderOpenTime");
/*      */ 
/* 4036 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4037 */     int ix = result.indexOf('@');
/* 4038 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4039 */     switch (error) { case 4105:
/* 4040 */       throw new ErrNoOrderSelected();
/*      */     }
/* 4042 */     if (error != 0) {
/* 4043 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4047 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4052 */     long time = Long.parseLong(result) * 1000L;
/* 4053 */     Date res = new Date(time + getTZCorrectionOffset(time));
/* 4054 */     return res;
/*      */   }
/*      */ 
/*      */   public void orderPrint()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 4065 */     StringBuilder command = new StringBuilder("91 orderPrint");
/*      */ 
/* 4071 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4072 */     int ix = result.indexOf('@');
/* 4073 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4074 */     switch (error) { case 4105:
/* 4075 */       throw new ErrNoOrderSelected();
/*      */     }
/* 4077 */     if (error != 0) {
/* 4078 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4082 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */   }
/*      */ 
/*      */   public double orderProfit()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 4099 */     StringBuilder command = new StringBuilder("92 orderProfit");
/*      */ 
/* 4105 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4106 */     int ix = result.indexOf('@');
/* 4107 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4108 */     switch (error) { case 4105:
/* 4109 */       throw new ErrNoOrderSelected();
/*      */     }
/* 4111 */     if (error != 0) {
/* 4112 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4116 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4121 */     double res = Double.parseDouble(result);
/* 4122 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean orderSelect(int index, SelectionType select, SelectionPool pool)
/*      */   {
/* 4139 */     StringBuilder command = new StringBuilder("93 orderSelect");
/*      */ 
/* 4143 */     command.append(' ').append('[').append(index).append(']');
/* 4144 */     command.append(' ').append('[').append(select.val).append(']');
/* 4145 */     command.append(' ').append('[').append(pool.val).append(']');
/*      */ 
/* 4147 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4148 */     int ix = result.indexOf('@');
/* 4149 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4150 */     switch (error)
/*      */     {
/*      */     }
/* 4153 */     if (error != 0) {
/* 4154 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4158 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4163 */     boolean res = Integer.parseInt(result) != 0;
/* 4164 */     return res;
/*      */   }
/*      */ 
/*      */   public int orderSend(String symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit, String comment, int magic, Date expiration, long arrowColor)
/*      */     throws ErrInvalidFunctionParamvalue, ErrCustomIndicatorError, ErrStringParameterExpected, ErrIntegerParameterExpected, ErrUnknownSymbol, ErrInvalidPriceParam, ErrTradeNotAllowed, ErrLongsNotAllowed, ErrShortsNotAllowed, ErrCommonError, ErrInvalidTradeParameters, ErrServerBusy, ErrOldVersion, ErrNoConnection, ErrTooFrequentRequests, ErrAccountDisabled, ErrInvalidAccount, ErrTradeTimeout, ErrInvalidPrice, ErrInvalidStops, ErrInvalidTradeVolume, ErrMarketClosed, ErrTradeDisabled, ErrNotEnoughMoney, ErrPriceChanged, ErrOffQuotes, ErrRequote, ErrOrderLocked, ErrLongPositionsOnlyAllowed, ErrTooManyRequests, ErrTradeTimeout2, ErrTradeTimeout3, ErrTradeTimeout4, ErrTradeModifyDenied, ErrTradeContextBusy, ErrTradeExpirationDenied, ErrTradeTooManyOrders
/*      */   {
/* 4197 */     StringBuilder command = new StringBuilder("94 orderSend");
/*      */ 
/* 4201 */     command.append(' ').append('[').append(symbol).append(']');
/* 4202 */     command.append(' ').append('[').append(cmd.val).append(']');
/* 4203 */     command.append(' ').append('[').append(volume).append(']');
/* 4204 */     command.append(' ').append('[').append(price).append(']');
/* 4205 */     command.append(' ').append('[').append(slippage).append(']');
/* 4206 */     command.append(' ').append('[').append(stoploss).append(']');
/* 4207 */     command.append(' ').append('[').append(takeprofit).append(']');
/* 4208 */     command.append(' ').append('[').append(comment).append(']');
/* 4209 */     command.append(' ').append('[').append(magic).append(']');
/* 4210 */     command.append(' ').append('[').append(expiration == null ? "1970.01.01 00:00" : new SimpleDateFormat("yyyy.MM.dd HH:mm").format(expiration)).append(']');
/* 4211 */     command.append(' ').append('[').append(arrowColor).append(']');
/*      */ 
/* 4213 */     String result = (this.ordersProcessingChannel == null ? this.strategyRunner : this.ordersProcessingChannel).sendCommandGetResult(command);
/* 4214 */     int ix = result.indexOf('@');
/* 4215 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4216 */     switch (error) { case 4051:
/* 4217 */       throw new ErrInvalidFunctionParamvalue();
/*      */     case 4055:
/* 4218 */       throw new ErrCustomIndicatorError();
/*      */     case 4062:
/* 4219 */       throw new ErrStringParameterExpected();
/*      */     case 4063:
/* 4220 */       throw new ErrIntegerParameterExpected();
/*      */     case 4106:
/* 4221 */       throw new ErrUnknownSymbol();
/*      */     case 4107:
/* 4222 */       throw new ErrInvalidPriceParam();
/*      */     case 4109:
/* 4223 */       throw new ErrTradeNotAllowed();
/*      */     case 4110:
/* 4224 */       throw new ErrLongsNotAllowed();
/*      */     case 4111:
/* 4225 */       throw new ErrShortsNotAllowed();
/*      */     case 0:
/* 4226 */       break;
/*      */     case 2:
/* 4227 */       throw new ErrCommonError();
/*      */     case 3:
/* 4228 */       throw new ErrInvalidTradeParameters();
/*      */     case 4:
/* 4229 */       throw new ErrServerBusy();
/*      */     case 5:
/* 4230 */       throw new ErrOldVersion();
/*      */     case 6:
/* 4231 */       throw new ErrNoConnection();
/*      */     case 8:
/* 4232 */       throw new ErrTooFrequentRequests();
/*      */     case 64:
/* 4233 */       throw new ErrAccountDisabled();
/*      */     case 65:
/* 4234 */       throw new ErrInvalidAccount();
/*      */     case 128:
/* 4235 */       throw new ErrTradeTimeout();
/*      */     case 129:
/* 4236 */       throw new ErrInvalidPrice();
/*      */     case 130:
/* 4237 */       throw new ErrInvalidStops();
/*      */     case 131:
/* 4238 */       throw new ErrInvalidTradeVolume();
/*      */     case 132:
/* 4239 */       throw new ErrMarketClosed();
/*      */     case 133:
/* 4240 */       throw new ErrTradeDisabled();
/*      */     case 134:
/* 4241 */       throw new ErrNotEnoughMoney();
/*      */     case 135:
/* 4242 */       throw new ErrPriceChanged();
/*      */     case 136:
/* 4243 */       throw new ErrOffQuotes();
/*      */     case 138:
/* 4244 */       throw new ErrRequote();
/*      */     case 139:
/* 4245 */       throw new ErrOrderLocked();
/*      */     case 140:
/* 4246 */       throw new ErrLongPositionsOnlyAllowed();
/*      */     case 141:
/* 4247 */       throw new ErrTooManyRequests();
/*      */     case 142:
/* 4248 */       throw new ErrTradeTimeout2();
/*      */     case 143:
/* 4249 */       throw new ErrTradeTimeout3();
/*      */     case 144:
/* 4250 */       throw new ErrTradeTimeout4();
/*      */     case 145:
/* 4251 */       throw new ErrTradeModifyDenied();
/*      */     case 146:
/* 4252 */       throw new ErrTradeContextBusy();
/*      */     case 147:
/* 4253 */       throw new ErrTradeExpirationDenied();
/*      */     case 148:
/* 4254 */       throw new ErrTradeTooManyOrders();
/*      */     default:
/* 4256 */       if (error == 0) break;
/* 4257 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4261 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4266 */     int res = Integer.parseInt(result);
/* 4267 */     return res;
/*      */   }
/*      */ 
/*      */   public int ordersHistoryTotal()
/*      */   {
/* 4278 */     StringBuilder command = new StringBuilder("95 ordersHistoryTotal");
/*      */ 
/* 4284 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4285 */     int ix = result.indexOf('@');
/* 4286 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4287 */     switch (error)
/*      */     {
/*      */     }
/* 4290 */     if (error != 0) {
/* 4291 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4295 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4300 */     int res = Integer.parseInt(result);
/* 4301 */     return res;
/*      */   }
/*      */ 
/*      */   public double orderStopLoss()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 4312 */     StringBuilder command = new StringBuilder("96 orderStopLoss");
/*      */ 
/* 4318 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4319 */     int ix = result.indexOf('@');
/* 4320 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4321 */     switch (error) { case 4105:
/* 4322 */       throw new ErrNoOrderSelected();
/*      */     }
/* 4324 */     if (error != 0) {
/* 4325 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4329 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4334 */     double res = Double.parseDouble(result);
/* 4335 */     return res;
/*      */   }
/*      */ 
/*      */   public int ordersTotal()
/*      */   {
/* 4346 */     StringBuilder command = new StringBuilder("97 ordersTotal");
/*      */ 
/* 4352 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4353 */     int ix = result.indexOf('@');
/* 4354 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4355 */     switch (error)
/*      */     {
/*      */     }
/* 4358 */     if (error != 0) {
/* 4359 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4363 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4368 */     int res = Integer.parseInt(result);
/* 4369 */     return res;
/*      */   }
/*      */ 
/*      */   public double orderSwap()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 4380 */     StringBuilder command = new StringBuilder("98 orderSwap");
/*      */ 
/* 4386 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4387 */     int ix = result.indexOf('@');
/* 4388 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4389 */     switch (error) { case 4105:
/* 4390 */       throw new ErrNoOrderSelected();
/*      */     }
/* 4392 */     if (error != 0) {
/* 4393 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4397 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4402 */     double res = Double.parseDouble(result);
/* 4403 */     return res;
/*      */   }
/*      */ 
/*      */   public String orderSymbol()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 4414 */     StringBuilder command = new StringBuilder("99 orderSymbol");
/*      */ 
/* 4420 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4421 */     int ix = result.indexOf('@');
/* 4422 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4423 */     switch (error) { case 4105:
/* 4424 */       throw new ErrNoOrderSelected();
/*      */     }
/* 4426 */     if (error != 0) {
/* 4427 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4431 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4436 */     String res = result;
/* 4437 */     return res;
/*      */   }
/*      */ 
/*      */   public double orderTakeProfit()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 4448 */     StringBuilder command = new StringBuilder("100 orderTakeProfit");
/*      */ 
/* 4454 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4455 */     int ix = result.indexOf('@');
/* 4456 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4457 */     switch (error) { case 4105:
/* 4458 */       throw new ErrNoOrderSelected();
/*      */     }
/* 4460 */     if (error != 0) {
/* 4461 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4465 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4470 */     double res = Double.parseDouble(result);
/* 4471 */     return res;
/*      */   }
/*      */ 
/*      */   public int orderTicket()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 4482 */     StringBuilder command = new StringBuilder("101 orderTicket");
/*      */ 
/* 4488 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4489 */     int ix = result.indexOf('@');
/* 4490 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4491 */     switch (error) { case 4105:
/* 4492 */       throw new ErrNoOrderSelected();
/*      */     }
/* 4494 */     if (error != 0) {
/* 4495 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4499 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4504 */     int res = Integer.parseInt(result);
/* 4505 */     return res;
/*      */   }
/*      */ 
/*      */   public int orderType()
/*      */     throws ErrNoOrderSelected
/*      */   {
/* 4516 */     StringBuilder command = new StringBuilder("102 orderType");
/*      */ 
/* 4522 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4523 */     int ix = result.indexOf('@');
/* 4524 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4525 */     switch (error) { case 4105:
/* 4526 */       throw new ErrNoOrderSelected();
/*      */     }
/* 4528 */     if (error != 0) {
/* 4529 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4533 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4538 */     int res = Integer.parseInt(result);
/* 4539 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean isTradeContextBusy()
/*      */   {
/* 4550 */     StringBuilder command = new StringBuilder("103 isTradeContextBusy");
/*      */ 
/* 4556 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4557 */     int ix = result.indexOf('@');
/* 4558 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4559 */     switch (error)
/*      */     {
/*      */     }
/* 4562 */     if (error != 0) {
/* 4563 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4567 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4572 */     boolean res = Integer.parseInt(result) != 0;
/* 4573 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean refreshRates()
/*      */   {
/* 4584 */     StringBuilder command = new StringBuilder("104 refreshRates");
/*      */ 
/* 4590 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4591 */     int ix = result.indexOf('@');
/* 4592 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4593 */     switch (error)
/*      */     {
/*      */     }
/* 4596 */     if (error != 0) {
/* 4597 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4601 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4606 */     boolean res = Integer.parseInt(result) != 0;
/* 4607 */     return res;
/*      */   }
/*      */ 
/*      */   public int accountStopoutLevel()
/*      */   {
/* 4618 */     StringBuilder command = new StringBuilder("105 accountStopoutLevel");
/*      */ 
/* 4624 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4625 */     int ix = result.indexOf('@');
/* 4626 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4627 */     switch (error)
/*      */     {
/*      */     }
/* 4630 */     if (error != 0) {
/* 4631 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4635 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4640 */     int res = Integer.parseInt(result);
/* 4641 */     return res;
/*      */   }
/*      */ 
/*      */   public int accountStopoutMode()
/*      */   {
/* 4652 */     StringBuilder command = new StringBuilder("106 accountStopoutMode");
/*      */ 
/* 4658 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4659 */     int ix = result.indexOf('@');
/* 4660 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4661 */     switch (error)
/*      */     {
/*      */     }
/* 4664 */     if (error != 0) {
/* 4665 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4669 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4674 */     int res = Integer.parseInt(result);
/* 4675 */     return res;
/*      */   }
/*      */ 
/*      */   public int messageBox(String text, String caption, int flags)
/*      */   {
/* 4692 */     StringBuilder command = new StringBuilder("107 messageBox");
/*      */ 
/* 4696 */     command.append(' ').append('[').append(text).append(']');
/* 4697 */     command.append(' ').append('[').append(caption).append(']');
/* 4698 */     command.append(' ').append('[').append(flags).append(']');
/*      */ 
/* 4700 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4701 */     int ix = result.indexOf('@');
/* 4702 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4703 */     switch (error)
/*      */     {
/*      */     }
/* 4706 */     if (error != 0) {
/* 4707 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4711 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4716 */     int res = Integer.parseInt(result);
/* 4717 */     return res;
/*      */   }
/*      */ 
/*      */   public int uninitializeReason()
/*      */   {
/* 4728 */     StringBuilder command = new StringBuilder("108 uninitializeReason");
/*      */ 
/* 4734 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4735 */     int ix = result.indexOf('@');
/* 4736 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4737 */     switch (error)
/*      */     {
/*      */     }
/* 4740 */     if (error != 0) {
/* 4741 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4745 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4750 */     int res = Integer.parseInt(result);
/* 4751 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean isTradeAllowed()
/*      */   {
/* 4762 */     StringBuilder command = new StringBuilder("109 isTradeAllowed");
/*      */ 
/* 4768 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4769 */     int ix = result.indexOf('@');
/* 4770 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4771 */     switch (error)
/*      */     {
/*      */     }
/* 4774 */     if (error != 0) {
/* 4775 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4779 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4784 */     boolean res = Integer.parseInt(result) != 0;
/* 4785 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean isStopped()
/*      */   {
/* 4796 */     StringBuilder command = new StringBuilder("110 isStopped");
/*      */ 
/* 4802 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4803 */     int ix = result.indexOf('@');
/* 4804 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4805 */     switch (error)
/*      */     {
/*      */     }
/* 4808 */     if (error != 0) {
/* 4809 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4813 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4818 */     boolean res = Integer.parseInt(result) != 0;
/* 4819 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean isOptimization()
/*      */   {
/* 4830 */     StringBuilder command = new StringBuilder("111 isOptimization");
/*      */ 
/* 4836 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4837 */     int ix = result.indexOf('@');
/* 4838 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4839 */     switch (error)
/*      */     {
/*      */     }
/* 4842 */     if (error != 0) {
/* 4843 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4847 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4852 */     boolean res = Integer.parseInt(result) != 0;
/* 4853 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean isLibrariesAllowed()
/*      */   {
/* 4864 */     StringBuilder command = new StringBuilder("112 isLibrariesAllowed");
/*      */ 
/* 4870 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4871 */     int ix = result.indexOf('@');
/* 4872 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4873 */     switch (error)
/*      */     {
/*      */     }
/* 4876 */     if (error != 0) {
/* 4877 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4881 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4886 */     boolean res = Integer.parseInt(result) != 0;
/* 4887 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean isDllsAllowed()
/*      */   {
/* 4898 */     StringBuilder command = new StringBuilder("113 isDllsAllowed");
/*      */ 
/* 4904 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4905 */     int ix = result.indexOf('@');
/* 4906 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4907 */     switch (error)
/*      */     {
/*      */     }
/* 4910 */     if (error != 0) {
/* 4911 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4915 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4920 */     boolean res = Integer.parseInt(result) != 0;
/* 4921 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean isExpertEnabled()
/*      */   {
/* 4932 */     StringBuilder command = new StringBuilder("114 isExpertEnabled");
/*      */ 
/* 4938 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4939 */     int ix = result.indexOf('@');
/* 4940 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4941 */     switch (error)
/*      */     {
/*      */     }
/* 4944 */     if (error != 0) {
/* 4945 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4949 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4954 */     boolean res = Integer.parseInt(result) != 0;
/* 4955 */     return res;
/*      */   }
/*      */ 
/*      */   public double accountFreeMarginCheck(String symbol, TradeOperation cmd, double volume)
/*      */   {
/* 4972 */     StringBuilder command = new StringBuilder("115 accountFreeMarginCheck");
/*      */ 
/* 4976 */     command.append(' ').append('[').append(symbol).append(']');
/* 4977 */     command.append(' ').append('[').append(cmd.val).append(']');
/* 4978 */     command.append(' ').append('[').append(volume).append(']');
/*      */ 
/* 4980 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 4981 */     int ix = result.indexOf('@');
/* 4982 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 4983 */     switch (error)
/*      */     {
/*      */     }
/* 4986 */     if (error != 0) {
/* 4987 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 4991 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 4996 */     double res = Double.parseDouble(result);
/* 4997 */     return res;
/*      */   }
/*      */ 
/*      */   public double accountFreeMarginMode()
/*      */   {
/* 5008 */     StringBuilder command = new StringBuilder("116 accountFreeMarginMode");
/*      */ 
/* 5014 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5015 */     int ix = result.indexOf('@');
/* 5016 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5017 */     switch (error)
/*      */     {
/*      */     }
/* 5020 */     if (error != 0) {
/* 5021 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5025 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5030 */     double res = Double.parseDouble(result);
/* 5031 */     return res;
/*      */   }
/*      */ 
/*      */   public int accountLeverage()
/*      */   {
/* 5042 */     StringBuilder command = new StringBuilder("117 accountLeverage");
/*      */ 
/* 5048 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5049 */     int ix = result.indexOf('@');
/* 5050 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5051 */     switch (error)
/*      */     {
/*      */     }
/* 5054 */     if (error != 0) {
/* 5055 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5059 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5064 */     int res = Integer.parseInt(result);
/* 5065 */     return res;
/*      */   }
/*      */ 
/*      */   public String accountServer()
/*      */   {
/* 5076 */     StringBuilder command = new StringBuilder("118 accountServer");
/*      */ 
/* 5082 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5083 */     int ix = result.indexOf('@');
/* 5084 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5085 */     switch (error)
/*      */     {
/*      */     }
/* 5088 */     if (error != 0) {
/* 5089 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5093 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5098 */     String res = result;
/* 5099 */     return res;
/*      */   }
/*      */ 
/*      */   public String terminalCompany()
/*      */   {
/* 5110 */     StringBuilder command = new StringBuilder("119 terminalCompany");
/*      */ 
/* 5116 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5117 */     int ix = result.indexOf('@');
/* 5118 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5119 */     switch (error)
/*      */     {
/*      */     }
/* 5122 */     if (error != 0) {
/* 5123 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5127 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5132 */     String res = result;
/* 5133 */     return res;
/*      */   }
/*      */ 
/*      */   public String terminalName()
/*      */   {
/* 5144 */     StringBuilder command = new StringBuilder("120 terminalName");
/*      */ 
/* 5150 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5151 */     int ix = result.indexOf('@');
/* 5152 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5153 */     switch (error)
/*      */     {
/*      */     }
/* 5156 */     if (error != 0) {
/* 5157 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5161 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5166 */     String res = result;
/* 5167 */     return res;
/*      */   }
/*      */ 
/*      */   public String terminalPath()
/*      */   {
/* 5178 */     StringBuilder command = new StringBuilder("121 terminalPath");
/*      */ 
/* 5184 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5185 */     int ix = result.indexOf('@');
/* 5186 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5187 */     switch (error)
/*      */     {
/*      */     }
/* 5190 */     if (error != 0) {
/* 5191 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5195 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5200 */     String res = result;
/* 5201 */     return res;
/*      */   }
/*      */ 
/*      */   public void alert(String arg)
/*      */   {
/* 5214 */     StringBuilder command = new StringBuilder("122 alert");
/*      */ 
/* 5218 */     command.append(' ').append('[').append(arg).append(']');
/*      */ 
/* 5220 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5221 */     int ix = result.indexOf('@');
/* 5222 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5223 */     switch (error)
/*      */     {
/*      */     }
/* 5226 */     if (error != 0) {
/* 5227 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5231 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */   }
/*      */ 
/*      */   public void playSound(String filename)
/*      */   {
/* 5250 */     StringBuilder command = new StringBuilder("123 playSound");
/*      */ 
/* 5254 */     command.append(' ').append('[').append(filename).append(']');
/*      */ 
/* 5256 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5257 */     int ix = result.indexOf('@');
/* 5258 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5259 */     switch (error)
/*      */     {
/*      */     }
/* 5262 */     if (error != 0) {
/* 5263 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5267 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */   }
/*      */ 
/*      */   public String objectDescription(String name)
/*      */   {
/* 5286 */     StringBuilder command = new StringBuilder("124 objectDescription");
/*      */ 
/* 5290 */     command.append(' ').append('[').append(name).append(']');
/*      */ 
/* 5292 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5293 */     int ix = result.indexOf('@');
/* 5294 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5295 */     switch (error)
/*      */     {
/*      */     }
/* 5298 */     if (error != 0) {
/* 5299 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5303 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5308 */     String res = result;
/* 5309 */     return res;
/*      */   }
/*      */ 
/*      */   public int objectFind(String name)
/*      */   {
/* 5322 */     StringBuilder command = new StringBuilder("125 objectFind");
/*      */ 
/* 5326 */     command.append(' ').append('[').append(name).append(']');
/*      */ 
/* 5328 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5329 */     int ix = result.indexOf('@');
/* 5330 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5331 */     switch (error)
/*      */     {
/*      */     }
/* 5334 */     if (error != 0) {
/* 5335 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5339 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5344 */     int res = Integer.parseInt(result);
/* 5345 */     return res;
/*      */   }
/*      */ 
/*      */   public int objectGetShiftByValue(String name, double value)
/*      */   {
/* 5360 */     StringBuilder command = new StringBuilder("126 objectGetShiftByValue");
/*      */ 
/* 5364 */     command.append(' ').append('[').append(name).append(']');
/* 5365 */     command.append(' ').append('[').append(value).append(']');
/*      */ 
/* 5367 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5368 */     int ix = result.indexOf('@');
/* 5369 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5370 */     switch (error)
/*      */     {
/*      */     }
/* 5373 */     if (error != 0) {
/* 5374 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5378 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5383 */     int res = Integer.parseInt(result);
/* 5384 */     return res;
/*      */   }
/*      */ 
/*      */   public double objectGetValueByShift(String name, int shift)
/*      */   {
/* 5399 */     StringBuilder command = new StringBuilder("127 objectGetValueByShift");
/*      */ 
/* 5403 */     command.append(' ').append('[').append(name).append(']');
/* 5404 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 5406 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5407 */     int ix = result.indexOf('@');
/* 5408 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5409 */     switch (error)
/*      */     {
/*      */     }
/* 5412 */     if (error != 0) {
/* 5413 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5417 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5422 */     double res = Double.parseDouble(result);
/* 5423 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean objectMove(String name, int point, Date time1, double price1)
/*      */   {
/* 5442 */     StringBuilder command = new StringBuilder("128 objectMove");
/*      */ 
/* 5446 */     command.append(' ').append('[').append(name).append(']');
/* 5447 */     command.append(' ').append('[').append(point).append(']');
/* 5448 */     command.append(' ').append('[').append(time1 == null ? "1970.01.01 00:00" : new SimpleDateFormat("yyyy.MM.dd HH:mm").format(time1)).append(']');
/* 5449 */     command.append(' ').append('[').append(price1).append(']');
/*      */ 
/* 5451 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5452 */     int ix = result.indexOf('@');
/* 5453 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5454 */     switch (error)
/*      */     {
/*      */     }
/* 5457 */     if (error != 0) {
/* 5458 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5462 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5467 */     boolean res = Integer.parseInt(result) != 0;
/* 5468 */     return res;
/*      */   }
/*      */ 
/*      */   public String objectName(int index)
/*      */   {
/* 5481 */     StringBuilder command = new StringBuilder("129 objectName");
/*      */ 
/* 5485 */     command.append(' ').append('[').append(index).append(']');
/*      */ 
/* 5487 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5488 */     int ix = result.indexOf('@');
/* 5489 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5490 */     switch (error)
/*      */     {
/*      */     }
/* 5493 */     if (error != 0) {
/* 5494 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5498 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5503 */     String res = result;
/* 5504 */     return res;
/*      */   }
/*      */ 
/*      */   public int objectsDeleteAll(int window, int type)
/*      */   {
/* 5519 */     StringBuilder command = new StringBuilder("130 objectsDeleteAll");
/*      */ 
/* 5523 */     command.append(' ').append('[').append(window).append(']');
/* 5524 */     command.append(' ').append('[').append(type).append(']');
/*      */ 
/* 5526 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5527 */     int ix = result.indexOf('@');
/* 5528 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5529 */     switch (error)
/*      */     {
/*      */     }
/* 5532 */     if (error != 0) {
/* 5533 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5537 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5542 */     int res = Integer.parseInt(result);
/* 5543 */     return res;
/*      */   }
/*      */ 
/*      */   public double iIchimoku(String symbol, Timeframe timeframe, int tenkan_sen, int kijun_sen, int senkou_span_b, IchimokuSource mode, int shift)
/*      */     throws ErrUnknownSymbol
/*      */   {
/* 5568 */     StringBuilder command = new StringBuilder("131 iIchimoku");
/*      */ 
/* 5572 */     command.append(' ').append('[').append(symbol).append(']');
/* 5573 */     command.append(' ').append('[').append(timeframe.val).append(']');
/* 5574 */     command.append(' ').append('[').append(tenkan_sen).append(']');
/* 5575 */     command.append(' ').append('[').append(kijun_sen).append(']');
/* 5576 */     command.append(' ').append('[').append(senkou_span_b).append(']');
/* 5577 */     command.append(' ').append('[').append(mode.val).append(']');
/* 5578 */     command.append(' ').append('[').append(shift).append(']');
/*      */ 
/* 5580 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5581 */     int ix = result.indexOf('@');
/* 5582 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5583 */     switch (error) { case 4106:
/* 5584 */       throw new ErrUnknownSymbol();
/*      */     }
/* 5586 */     if (error != 0) {
/* 5587 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5591 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5596 */     double res = Double.parseDouble(result);
/* 5597 */     return res;
/*      */   }
/*      */ 
/*      */   public void hideTestIndicators(boolean shift)
/*      */   {
/* 5610 */     StringBuilder command = new StringBuilder("132 hideTestIndicators");
/*      */ 
/* 5614 */     command.append(' ').append('[').append(shift ? 1 : 0).append(']');
/*      */ 
/* 5616 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5617 */     int ix = result.indexOf('@');
/* 5618 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5619 */     switch (error)
/*      */     {
/*      */     }
/* 5622 */     if (error != 0) {
/* 5623 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5627 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */   }
/*      */ 
/*      */   public int period()
/*      */   {
/* 5644 */     StringBuilder command = new StringBuilder("133 period");
/*      */ 
/* 5650 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5651 */     int ix = result.indexOf('@');
/* 5652 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5653 */     switch (error)
/*      */     {
/*      */     }
/* 5656 */     if (error != 0) {
/* 5657 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5661 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5666 */     int res = Integer.parseInt(result);
/* 5667 */     return res;
/*      */   }
/*      */ 
/*      */   public String symbol()
/*      */   {
/* 5678 */     StringBuilder command = new StringBuilder("134 symbol");
/*      */ 
/* 5684 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5685 */     int ix = result.indexOf('@');
/* 5686 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5687 */     switch (error)
/*      */     {
/*      */     }
/* 5690 */     if (error != 0) {
/* 5691 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5695 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5700 */     String res = result;
/* 5701 */     return res;
/*      */   }
/*      */ 
/*      */   public int windowBarsPerChart()
/*      */   {
/* 5712 */     StringBuilder command = new StringBuilder("135 windowBarsPerChart");
/*      */ 
/* 5718 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5719 */     int ix = result.indexOf('@');
/* 5720 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5721 */     switch (error)
/*      */     {
/*      */     }
/* 5724 */     if (error != 0) {
/* 5725 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5729 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5734 */     int res = Integer.parseInt(result);
/* 5735 */     return res;
/*      */   }
/*      */ 
/*      */   public int windowFirstVisibleBar()
/*      */   {
/* 5746 */     StringBuilder command = new StringBuilder("136 windowFirstVisibleBar");
/*      */ 
/* 5752 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5753 */     int ix = result.indexOf('@');
/* 5754 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5755 */     switch (error)
/*      */     {
/*      */     }
/* 5758 */     if (error != 0) {
/* 5759 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5763 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5768 */     int res = Integer.parseInt(result);
/* 5769 */     return res;
/*      */   }
/*      */ 
/*      */   public String windowExpertName()
/*      */   {
/* 5780 */     StringBuilder command = new StringBuilder("137 windowExpertName");
/*      */ 
/* 5786 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5787 */     int ix = result.indexOf('@');
/* 5788 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5789 */     switch (error)
/*      */     {
/*      */     }
/* 5792 */     if (error != 0) {
/* 5793 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5797 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5802 */     String res = result;
/* 5803 */     return res;
/*      */   }
/*      */ 
/*      */   public int windowFind(String name)
/*      */   {
/* 5816 */     StringBuilder command = new StringBuilder("138 windowFind");
/*      */ 
/* 5820 */     command.append(' ').append('[').append(name).append(']');
/*      */ 
/* 5822 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5823 */     int ix = result.indexOf('@');
/* 5824 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5825 */     switch (error)
/*      */     {
/*      */     }
/* 5828 */     if (error != 0) {
/* 5829 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5833 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5838 */     int res = Integer.parseInt(result);
/* 5839 */     return res;
/*      */   }
/*      */ 
/*      */   public boolean windowIsVisible(int index)
/*      */   {
/* 5852 */     StringBuilder command = new StringBuilder("139 windowIsVisible");
/*      */ 
/* 5856 */     command.append(' ').append('[').append(index).append(']');
/*      */ 
/* 5858 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5859 */     int ix = result.indexOf('@');
/* 5860 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5861 */     switch (error)
/*      */     {
/*      */     }
/* 5864 */     if (error != 0) {
/* 5865 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5869 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5874 */     boolean res = Integer.parseInt(result) != 0;
/* 5875 */     return res;
/*      */   }
/*      */ 
/*      */   public double windowPriceMax(int index)
/*      */   {
/* 5888 */     StringBuilder command = new StringBuilder("140 windowPriceMax");
/*      */ 
/* 5892 */     command.append(' ').append('[').append(index).append(']');
/*      */ 
/* 5894 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5895 */     int ix = result.indexOf('@');
/* 5896 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5897 */     switch (error)
/*      */     {
/*      */     }
/* 5900 */     if (error != 0) {
/* 5901 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5905 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5910 */     double res = Double.parseDouble(result);
/* 5911 */     return res;
/*      */   }
/*      */ 
/*      */   public double windowPriceMin(int index)
/*      */   {
/* 5924 */     StringBuilder command = new StringBuilder("141 windowPriceMin");
/*      */ 
/* 5928 */     command.append(' ').append('[').append(index).append(']');
/*      */ 
/* 5930 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5931 */     int ix = result.indexOf('@');
/* 5932 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5933 */     switch (error)
/*      */     {
/*      */     }
/* 5936 */     if (error != 0) {
/* 5937 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5941 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5946 */     double res = Double.parseDouble(result);
/* 5947 */     return res;
/*      */   }
/*      */ 
/*      */   public int windowOnDropped()
/*      */   {
/* 5958 */     StringBuilder command = new StringBuilder("142 windowOnDropped");
/*      */ 
/* 5964 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5965 */     int ix = result.indexOf('@');
/* 5966 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 5967 */     switch (error)
/*      */     {
/*      */     }
/* 5970 */     if (error != 0) {
/* 5971 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 5975 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 5980 */     int res = Integer.parseInt(result);
/* 5981 */     return res;
/*      */   }
/*      */ 
/*      */   public int windowXOnDropped()
/*      */   {
/* 5992 */     StringBuilder command = new StringBuilder("143 windowXOnDropped");
/*      */ 
/* 5998 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 5999 */     int ix = result.indexOf('@');
/* 6000 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 6001 */     switch (error)
/*      */     {
/*      */     }
/* 6004 */     if (error != 0) {
/* 6005 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 6009 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 6014 */     int res = Integer.parseInt(result);
/* 6015 */     return res;
/*      */   }
/*      */ 
/*      */   public int windowYOnDropped()
/*      */   {
/* 6026 */     StringBuilder command = new StringBuilder("144 windowYOnDropped");
/*      */ 
/* 6032 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 6033 */     int ix = result.indexOf('@');
/* 6034 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 6035 */     switch (error)
/*      */     {
/*      */     }
/* 6038 */     if (error != 0) {
/* 6039 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 6043 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 6048 */     int res = Integer.parseInt(result);
/* 6049 */     return res;
/*      */   }
/*      */ 
/*      */   public double windowPriceOnDropped()
/*      */   {
/* 6060 */     StringBuilder command = new StringBuilder("145 windowPriceOnDropped");
/*      */ 
/* 6066 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 6067 */     int ix = result.indexOf('@');
/* 6068 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 6069 */     switch (error)
/*      */     {
/*      */     }
/* 6072 */     if (error != 0) {
/* 6073 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 6077 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 6082 */     double res = Double.parseDouble(result);
/* 6083 */     return res;
/*      */   }
/*      */ 
/*      */   public Date windowTimeOnDropped()
/*      */   {
/* 6094 */     StringBuilder command = new StringBuilder("146 windowTimeOnDropped");
/*      */ 
/* 6100 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 6101 */     int ix = result.indexOf('@');
/* 6102 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 6103 */     switch (error)
/*      */     {
/*      */     }
/* 6106 */     if (error != 0) {
/* 6107 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 6111 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 6116 */     long time = Long.parseLong(result) * 1000L;
/* 6117 */     Date res = new Date(time + getTZCorrectionOffset(time));
/* 6118 */     return res;
/*      */   }
/*      */ 
/*      */   public int windowsTotal()
/*      */   {
/* 6129 */     StringBuilder command = new StringBuilder("147 windowsTotal");
/*      */ 
/* 6135 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 6136 */     int ix = result.indexOf('@');
/* 6137 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 6138 */     switch (error)
/*      */     {
/*      */     }
/* 6141 */     if (error != 0) {
/* 6142 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 6146 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 6151 */     int res = Integer.parseInt(result);
/* 6152 */     return res;
/*      */   }
/*      */ 
/*      */   public void windowRedraw()
/*      */   {
/* 6163 */     StringBuilder command = new StringBuilder("148 windowRedraw");
/*      */ 
/* 6169 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 6170 */     int ix = result.indexOf('@');
/* 6171 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 6172 */     switch (error)
/*      */     {
/*      */     }
/* 6175 */     if (error != 0) {
/* 6176 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 6180 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */   }
/*      */ 
/*      */   public boolean windowScreenShot(String filename, int sizeX, int sizeY, int startBar, int chartScale, int chartMode)
/*      */   {
/* 6209 */     StringBuilder command = new StringBuilder("149 windowScreenShot");
/*      */ 
/* 6213 */     command.append(' ').append('[').append(filename).append(']');
/* 6214 */     command.append(' ').append('[').append(sizeX).append(']');
/* 6215 */     command.append(' ').append('[').append(sizeY).append(']');
/* 6216 */     command.append(' ').append('[').append(startBar).append(']');
/* 6217 */     command.append(' ').append('[').append(chartScale).append(']');
/* 6218 */     command.append(' ').append('[').append(chartMode).append(']');
/*      */ 
/* 6220 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 6221 */     int ix = result.indexOf('@');
/* 6222 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 6223 */     switch (error)
/*      */     {
/*      */     }
/* 6226 */     if (error != 0) {
/* 6227 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 6231 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 6236 */     boolean res = Integer.parseInt(result) != 0;
/* 6237 */     return res;
/*      */   }
/*      */ 
/*      */   public int windowHandle(String symbol, Timeframe timeframe)
/*      */   {
/* 6252 */     StringBuilder command = new StringBuilder("150 windowHandle");
/*      */ 
/* 6256 */     command.append(' ').append('[').append(symbol).append(']');
/* 6257 */     command.append(' ').append('[').append(timeframe.val).append(']');
/*      */ 
/* 6259 */     String result = this.strategyRunner.sendCommandGetResult(command);
/* 6260 */     int ix = result.indexOf('@');
/* 6261 */     int error = ix >= 0 ? Integer.parseInt(result.substring(ix + 1)) : 0;
/* 6262 */     switch (error)
/*      */     {
/*      */     }
/* 6265 */     if (error != 0) {
/* 6266 */       throw new RuntimeException("Unexpected error occurred: " + error);
/*      */     }
/*      */ 
/* 6270 */     result = ix >= 0 ? result.substring(0, ix) : result;
/*      */ 
/* 6275 */     int res = Integer.parseInt(result);
/* 6276 */     return res;
/*      */   }
/*      */ }

/* Location:           C:\Users\froge\workspace\jfx126_bin\lib\jfx.jar
 * Qualified Name:     com.jfx.MT4
 * JD-Core Version:    0.6.0
 */